admin/index.php: add server-side pagination (25/page)

- Add Database::getThesesListCount(array $filters) — runs the same WHERE
  clauses as getThesesList() but with COUNT(DISTINCT t.id); used to compute
  total pages without loading all rows.
- Extend Database::getThesesList() with $limit/$offset parameters; when
  $limit > 0 appends LIMIT/OFFSET and re-binds positional params individually
  to avoid the PDO mixed-style restriction.
- Fix getThesesList() SELECT: add LEFT JOIN access_types + at.name as
  access_type — the column was referenced in the template but never fetched.
- Wire admin/index.php: read ?page=, compute $totalPages/$offset, pass
  $perPage=25 + $offset to getThesesList(); include pagination.php partial
  below the table with filter-preserving $baseParams.
- Add result-count line (<p class="admin-list-meta">) showing "X–Y sur Z TFE"
  when multiple pages exist.
- Add .admin-body .pagination-wrap / .pagination-btn / .pagination-info styles
  to admin.css (scoped to .admin-body to avoid colliding with public pages).
This commit is contained in:
Pontoporeia
2026-04-03 12:29:09 +02:00
parent ff8e33727d
commit 234d7bae40
6 changed files with 183 additions and 25 deletions

View File

@@ -343,6 +343,29 @@
color: var(--text-primary);
}
.admin-maintenance-bar form {
display: inline;
}
/* Result-count line above the thesis table */
.admin-list-meta {
color: var(--text-secondary);
font-size: 0.85rem;
margin-bottom: 0.5rem;
}
/* Empty-state message below the thesis table */
.admin-empty {
color: var(--text-secondary);
padding: 1rem 0;
}
/* Identifier column in the thesis table */
.admin-table-id {
color: var(--text-secondary);
font-size: 0.8rem;
}
/* ── Filters bar ────────────────────────────────────────────────────────── */
.admin-filters {
display: flex;
@@ -808,3 +831,52 @@
color: var(--text-secondary);
text-decoration: underline;
}
/* ── Pagination (admin list) ─────────────────────────────────────────────── */
.admin-body .pagination-wrap {
display: flex;
justify-content: center;
align-items: center;
gap: 0.5rem;
padding: 1.5rem 0 0.5rem;
}
.admin-body .pagination-wrap ul {
display: flex;
gap: 0.25rem;
list-style: none;
margin: 0;
padding: 0;
}
.admin-body .pagination-btn {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 2.75rem;
min-height: 2.75rem;
padding: 0 0.6rem;
border: 1px solid var(--border-secondary);
border-radius: 3px;
color: var(--text-primary);
font-size: 0.9rem;
text-decoration: none;
transition: border-color 0.15s, color 0.15s;
}
.admin-body .pagination-btn:hover:not(.disabled) {
border-color: var(--admin-purple);
color: var(--admin-purple);
}
.admin-body .pagination-btn.disabled {
opacity: 0.3;
cursor: not-allowed;
pointer-events: none;
}
.admin-body .pagination-info {
font-size: 0.9rem;
color: var(--text-secondary);
padding: 0 0.5rem;
}