diff --git a/src/Pagination/Pagination.php b/src/Pagination/Pagination.php index 16d053f8256c5489732ac8331c8cbd8261dc5b09..0fdb8726061da5fc4d0a32bee7031fbf7b906c32 100644 --- a/src/Pagination/Pagination.php +++ b/src/Pagination/Pagination.php @@ -32,12 +32,12 @@ class Pagination public static function getCurrentPageNumber(array $options): int { - return intval($options[self::CURRENT_PAGE_NUMBER_PARAMETER_NAME] ?? self::CURRENT_PAGE_NUMBER_DEFAULT); + return max(1, intval($options[self::CURRENT_PAGE_NUMBER_PARAMETER_NAME]) ?? self::CURRENT_PAGE_NUMBER_DEFAULT); } public static function getMaxNumItemsPerPage(array $options): int { - return intval($options[self::MAX_NUM_ITEMS_PER_PAGE_PARAMETER_NAME] ?? self::MAX_NUM_ITEMS_PER_PAGE_DEFAULT); + return max(1, intval($options[self::MAX_NUM_ITEMS_PER_PAGE_PARAMETER_NAME]) ?? self::MAX_NUM_ITEMS_PER_PAGE_DEFAULT); } public static function isPartialPagination(array $options): bool