From 222ee6bde270712fee60c1b796a65f7b7dd4979f Mon Sep 17 00:00:00 2001 From: PingMetal Date: Sun, 18 Dec 2016 05:13:58 -0500 Subject: [PATCH] Fixed a pagination bug Depending on the current page, a page not supposed to show up in the pagination summary can be skipped without returning a null value. It makes it difficult to know it is existent, but just skipped. --- core/PaginatedList.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/PaginatedList.php b/core/PaginatedList.php index 2d07f82d2..a332f57c8 100644 --- a/core/PaginatedList.php +++ b/core/PaginatedList.php @@ -293,6 +293,7 @@ class PaginatedList extends SS_ListDecorator { } $left = max($current - $offset, 1); + $right = min($current + $offset, $total); $range = range($current - $offset, $current + $offset); if ($left + $context > $total) { @@ -304,7 +305,7 @@ class PaginatedList extends SS_ListDecorator { $num = $i + 1; $emptyRange = $num != 1 && $num != $total && ( - $num == $left - 1 || $num == $left + $context + 1 + $num == $left - 1 || $num == $right + 1 ); if ($emptyRange) {