public function onRun() { $this->prepareVars(); $this->category = $this->page['category'] = $this->loadCategory(); $this->posts = $this->page['posts'] = $this->listPosts(); /* * If the page number is not valid, redirect */ if ($pageNumberParam = $this->paramName('pageNumber')) { // @deprecated remove if year >= 2015 $deprecatedPageNumber = $this->propertyOrParam('pageParam'); $currentPage = $this->property('pageNumber', $deprecatedPageNumber); if ($currentPage > ($lastPage = $this->posts->getLastPage()) && $currentPage > 1) { return Redirect::to($this->currentPageUrl([$pageNumberParam => $lastPage])); } } }