diff --git a/system/Pager/PagerRenderer.php b/system/Pager/PagerRenderer.php index 9076fed28dc0..173f2c4b79f1 100644 --- a/system/Pager/PagerRenderer.php +++ b/system/Pager/PagerRenderer.php @@ -83,17 +83,17 @@ class PagerRenderer protected $pageSelector; /** - * The number of items a page. + * The maximum number of items displayed per page. */ protected ?int $perPage; /** - * The total items the current has started. + * The index of the first item on the current page. */ protected ?int $perPageStart; /** - * The total items of the current page; + * The index of the last item on the current page.s */ protected ?int $perPageEnd; diff --git a/tests/system/Pager/PagerRendererTest.php b/tests/system/Pager/PagerRendererTest.php index 8d0095854374..7f97c9c10a9f 100644 --- a/tests/system/Pager/PagerRendererTest.php +++ b/tests/system/Pager/PagerRendererTest.php @@ -621,6 +621,9 @@ public function testGetNextPageNumberNull(): void $this->assertNull($pager->getNextPageNumber()); } + /** + * @param array> $details + */ #[DataProvider('providePageStartEnd')] public function testPageStartEnd(array $details, int $pageStart, int $pageEnd): void { @@ -631,6 +634,9 @@ public function testPageStartEnd(array $details, int $pageStart, int $pageEnd): $this->assertSame($pager->getPerPageEnd(), $pageEnd); } + /** + * @return array> $details + */ public static function providePageStartEnd(): iterable { $uri = new URI('http://example.com/foo'); @@ -669,6 +675,28 @@ public static function providePageStartEnd(): iterable 'pageStart' => 21, 'pageEnd' => 25, ], + 'current greater last page' => [ + 'details' => [ + 'uri' => $uri, + 'pageCount' => 3, + 'total' => 25, + 'currentPage' => 5, + 'perPage' => 10, + ], + 'pageStart' => 41, + 'pageEnd' => 50, + ], + 'current equal last page' => [ + 'details' => [ + 'uri' => $uri, + 'pageCount' => 1, + 'total' => 10, + 'currentPage' => 1, + 'perPage' => 10, + ], + 'pageStart' => 1, + 'pageEnd' => 10, + ], ]; } }