diff --git a/src/config/config.example.php b/src/config/config.example.php index 599a0d0..8a8a572 100644 --- a/src/config/config.example.php +++ b/src/config/config.example.php @@ -44,3 +44,9 @@ define('FORBIDDEN_EXTENSIONS', ['swf', 'js', 'html', 'htm']); */ define('PIWIK_URL', false); define('PIWIK_ID', false); + +/** + * Number of pages to show before and after the current page in the pagination. e.g. default (5) on page 37: + * < 1 ... 32 33 34 35 36 *37** 38 39 40 40 42 ... 115 > + */ +define("PAGINATION_PADDING", 5); \ No newline at end of file diff --git a/src/helpers/Twig.php b/src/helpers/Twig.php index c55b6ef..f2875b2 100755 --- a/src/helpers/Twig.php +++ b/src/helpers/Twig.php @@ -45,7 +45,8 @@ class Twig } private static function getPaginationFunction() { - return new \Twig_Function('paginationFunction', function ($numPages, $page, $padding = 2) { + return new \Twig_Function('paginationFunction', function ($numPages, $page) { + $padding = PAGINATION_PADDING; $pages = [1]; $i = 2; while ($i <= $numPages) { diff --git a/src/templates/macros.twig b/src/templates/macros.twig index c3e8281..e634ad4 100755 --- a/src/templates/macros.twig +++ b/src/templates/macros.twig @@ -16,7 +16,7 @@ {% macro pagination(num_pages, page) %} {% import _self as m %} - {% set pagearray = paginationFunction(num_pages, page,5) %} + {% set pagearray = paginationFunction(num_pages, page) %}