[], 'total' => 0]); } $limit = (int) ($_GET['limit'] ?? 10); $offset = (int) ($_GET['offset'] ?? 0); $search = trim((string) ($_GET['search'] ?? '')); $order = (string) ($_GET['order'] ?? 'key'); $dir = (string) ($_GET['dir'] ?? 'asc'); $result = PermissionService::listPaged([ 'limit' => $limit, 'offset' => $offset, 'search' => $search, 'order' => $order, 'dir' => $dir, ]); $rows = []; foreach ($result['data'] ?? [] as $row) { $rows[] = [ 'id' => $row['id'] ?? null, 'key' => $row['key'] ?? '', 'description' => $row['description'] ?? '', 'created' => dt($row['created'] ?? ''), ]; } Router::json([ 'data' => $rows, 'total' => $result['total'] ?? 0, ]);