diff --git a/app/templates/pagination.php b/app/templates/pagination.php index 02b6f44..52f16a0 100644 --- a/app/templates/pagination.php +++ b/app/templates/pagination.php @@ -6,11 +6,14 @@ * $totalPages - Total number of pages */ -// Ensure required variables are set +// Validate required pagination variables if (!isset($currentPage) || !isset($totalPages)) { return; } +// Ensure valid values +$currentPage = max(1, min($currentPage, $totalPages)); + // Number of page links to show before and after current page $range = 2; ?>