context->transport->paginator->pageCount; $delta = 3; $pagesVisible = array_merge($pagesVisible, range($this->context->transport->paginator->page - $delta, $this->context->transport->paginator->page + $delta)); $pagesVisible = array_filter($pagesVisible, function($x) { return $x >= 1 and $x <= $this->context->transport->paginator->pageCount; }); $pagesVisible = array_unique($pagesVisible); sort($pagesVisible, SORT_NUMERIC); if (!function_exists('pageUrl')) { function pageUrl($page) { $context = \Chibi\Registry::getContext(); $controller = $context->route->simpleControllerName; $action = $context->route->simpleActionName; $page = max(1, $page); $page = min($context->transport->paginator->pageCount, $page); $params = $context->route->arguments; $params['page'] = $page; return \Chibi\UrlHelper::route($controller, $action, $params); } } ?>