Contao\DC_Table::paginationMenu PHP Method

paginationMenu() protected method

Return a pagination menu to browse results
protected paginationMenu ( ) : string
return string
    protected function paginationMenu()
    {
        /** @var AttributeBagInterface $objSessionBag */
        $objSessionBag = \System::getContainer()->get('session')->getBag('contao_backend');
        $session = $objSessionBag->all();
        $filter = $GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] == 4 ? $this->strTable . '_' . CURRENT_ID : $this->strTable;
        list($offset, $limit) = explode(',', $this->limit);
        // Set the limit filter based on the page number
        if (isset($_GET['lp'])) {
            $lp = intval(\Input::get('lp')) - 1;
            if ($lp >= 0 && $lp < ceil($this->total / $limit)) {
                $session['filter'][$filter]['limit'] = $lp * $limit . ',' . $limit;
                $objSessionBag->replace($session);
            }
            $this->redirect(preg_replace('/&(amp;)?lp=[^&]+/i', '', \Environment::get('request')));
        }
        if ($limit) {
            \Input::setGet('lp', $offset / $limit + 1);
        }
        $objPagination = new \Pagination($this->total, $limit, 7, 'lp', new \BackendTemplate('be_pagination'), true);
        return $objPagination->generate();
    }