From Zend\Paginator\Adapter\Null
15567
public function getItems($offset, $itemCountPerPage)
    {
        if ($offset >= $this->count()) {
            return array();
        }

        $remainItemCount  = $this->count() - $offset;
        $currentItemCount = $remainItemCount > $itemCountPerPage ? $itemCountPerPage : $remainItemCount;

        return array_fill(0, $currentItemCount, null);
    }
973126
public function getAdapter()
    {
        /**
         * Check for an adapter being defined. if not, fetch the default adapter.
         */
        if ($this->_adapter === null) {
            $this->_adapter = Zend_Db_Table_Abstract::getDefaultAdapter();
            if (null === $this->_adapter) {

                throw new Zend_Validate_Exception('No database adapter present');
            }
        }
        return $this->_adapter;
    }
1272068
private function paginate()
    {
        $this->list = null;
        try {
            $query = $this->prepareQuery();
            $this->addFilters($query);
            $this->checkReturnFields($query);
            $this->addOrders($query);
            list($page, $limit) = $this->extractPagination();
            if ($limit === -1) {
                $this->list = $query->find($this->con);
            } else {
                $this->list = $query->paginate($page, $limit, $this->con);
            }
        } catch (\Exception $e) {
            Logger::log($e->getMessage(), LOG_ERR);
        }
    }
646514
public function get_data() {
		$data = null;
		if ( ! empty( $this->struct['value'] ) ) {
			$data[ $this->slug ] = $this->struct['value'];
		}

		return $data;
	}
987702
public function render()
    {
        if ( ! $this->hasPages()) {
            return null;
        }

        return sprintf(
            $this->wrapper,
            $this->getPreviousButton(),
            $this->pageLabel,
            $this->getSelect(),
            $this->getPageOfLabel(),
            $this->getNextButton()
        );
    }
513097
protected function preparePagination(&$offset, &$limit): ?string
    {
        $total   = count($this->images);
        $perPage = $this->get('perPage');

        // Paginate the result of not randomly sorted (see #8033)
        if ($perPage > 0 && $this->get('sortBy') != 'random') {
            // Get the current page
            $parameter = 'page_g' . $this->get('id');
            $page      = (Input::get($parameter) !== null) ? Input::get($parameter) : 1;

            // Do not index or cache the page if the page number is outside the range
            if ($page < 1 || $page > max(ceil($total / $perPage), 1)) {
                throw new PageNotFoundException('Page not found: ' . Environment::get('uri'));
            }

            // Set limit and offset
            $offset = (($page - 1) * $perPage);
            $limit  = min(($perPage + $offset), $total);

            $pagination = new Pagination(
                $total,
                $perPage,
                Config::get('maxPaginationLinks'),
                $parameter
            );

            return $pagination->generate("\n  ");
        }

        return null;
    }
1331486
public function prepare()
    {
        if ($this->ready) {
            return null;
        }

        $this->ready = true;

        $controller = $this->fullController;

        $methods = get_class_methods($controller);
        $allowedMethods = array_keys(self::$valids);

        $classMethods = array_intersect($methods, $allowedMethods);

        if (empty($classMethods)) {
            throw new Exception($controller . ' controller exists, but is not a valid', 2);
        }

        $contentType = $this->contentType . '; charset=' . $this->charset;

        foreach ($classMethods as $method) {
            $route = empty(self::$valids[$method]) ? false : self::$valids[$method];

            if ($route) {
                Route::set($route[0], $route[1], function ()
                use ($method, $contentType, $controller) {
                    header('Content-Type: ' . $contentType);

                    return call_user_func_array(array(new $controller, $method), func_get_args());
                });
            }
        }
    }
1142375
public function init()
    {
        $pageList = $this->pageRepo->getAllPageIdsAndNamesBySiteThenType($this->currentSite->getSiteId(), 't');

        $pageList['blank'] = 'Blank Page';

        $layoutChoices = $this->layoutManager->siteThemeLayoutsConfigToAssociativeArray(
            $this->layoutManager->getSiteThemeLayoutsConfig($this->currentSite->getTheme())
        );

        $filter = new InputFilter();

        $this->add(
            [
                'name' => 'url',
                'options' => [
                    'label' => 'Page Url',
                ],
                'type' => 'text',

            ]
        );

        $filter->add(
            [
                'name' => 'url',
                'required' => true,
                'filters' => [
                    ['name' => \Zend\Filter\StripTags::class],
                    [
                        'name' => \Zend\Filter\StringTrim::class,
                        'options' => [
                            'charlist' => '-_',
                        ]
                    ],
                ],
                'validators' => [
                    $this->safeValidatorServices['pageValidator'],
                ],
            ]
        );

        $this->add(
            [
                'name' => 'title',
                'options' => [
                    'label' => 'Page Title',
                ],
                'type' => 'text',
            ]
        );

        $filter->add(
            [
                'name' => 'title',
                'required' => true,
                'filters' => [
                    ['name' => \Zend\Filter\StripTags::class],
                    ['name' => \Zend\Filter\StringTrim::class],
                ],
                'validators' => [
                    [
                        'name' => \Zend\I18n\Validator\Alnum::class,
                        'options' => [
                            'allowWhiteSpace' => true,
                        ]
                    ],
                ],
            ]
        );

        $this->add(
            [
                'name' => 'page-template',
                'options' => [
                    'label' => 'Page Template',
                    'value_options' => $pageList,
                ],
                'type' => 'Zend\Form\Element\Select',
            ]
        );

        $filter->add(
            [
                'name' => 'page-template',
                'required' => true,
                'filters' => [
                    ['name' => \Zend\Filter\StripTags::class],
                    ['name' => \Zend\Filter\StringTrim::class],
                ],
                'validators' => [
                    $this->safeValidatorServices['templateValidator'],
                ],
            ]
        );


        $this->add(
            [
                'name' => 'main-layout',
                'options' => [
                    'label' => 'Main Layout',
                    'options' => $layoutChoices,
                ],
                'type' => 'Zend\Form\Element\Select',
            ]
        );

        $filter->add(
            [
                'name' => 'main-layout',
                'filters' => [
                    ['name' => \Zend\Filter\StripTags::class],
                    ['name' => \Zend\Filter\StringTrim::class],
                ],
                'validators' => [
                    $this->safeValidatorServices['layoutValidator'],
                ],
            ]
        );

        $this->setInputFilter($filter);
    }
546237
public function getPage() {
    $page = $this->traverse($this->pageMap, Server::getRequestUriParts());
    if ($page === null) {
      return null;
    }
    return $this->createWebPageFromClassName($page);
  }
529381
public function asNull(): Primitive\NullType
    {
        if (!$this->_element instanceof Primitive\NullType) {
            throw new \UnexpectedValueException(
                $this->_generateExceptionMessage(Element::TYPE_NULL));
        }
        return $this->_element;
    }
1053216
public function setPagination()
    {

        $total = $this->getListTotal();

        if (empty($total))
            return null;

        //Get the current page state from the request;
        $limit = $this->getListLimit();
        $current = $this->getState("currentpage", 1);
        $pages = array();

        //@TODO: Calculates the pages from a recordset or an array of results
        $pages['total'] = ceil($total / $limit);
        $pages['limit'] = $limit;

        //Get the real path to the current page
        $route = $this->container->router->getMatchedRoute();


        $pages['current'] = $route->getURLfromPathWithValues(["page" => strval($current)]);
        //Previous page link
        if (intval($current - 1) > 0):
            $pages['previous'] = $route->getURLfromPathWithValues(["page" => strval($current - 1)] );
        endif;
        //Next page link
        if (intval($current + 1) <= $pages['total']):
            $pages['next'] = $route->getURLfromPathWithValues(["page" => strval($current + 1)] );
        endif;

        //Build the pages;
        for ($i = 0; $i < $pages['total']; $i++):
            $page = $i + 1;
            $pages['pages'][] = array(
                "page_title" => strval($page),
                "page_link" => $route->getURLfromPathWithValues(["page" => $page] ),
                "page_state" => ($page == $current) ? "active" : null,
            );
        endfor;

        //Sets the pagination output;
        if (sizeof($pages['pages']) > 1)
            $this->pagination = $pages;

    }
195126
public function getData()
	{
		if ($this->usePaginator()) {
			$iterator = (new Paginator($this->getQuery()))->getIterator();

			$data = iterator_to_array($iterator);
		} else {
			$data = $this->getQuery()->getResult();
		}

		$this->onDataLoaded($data);

		return $data;
	}
453428
protected function getPagination()
    {
        if (null == $this->pagination) {
            $this->pagination = new Pagination(
                [
                    'rowsPerPage' => $this->rowsPerPage,
                    'request' => $this->getRequest()
                ]
            );
        }
        return $this->pagination;
    }
988576
public function loadIndexedRow()
    {
        if ($this->stmt === null) {
            return null;
        }

        return $this->stmt->fetch(\PDO::FETCH_NUM);
    }
1369601
public function fetch()
    {
        $adapter = $this->getAdapter();
        if (!$adapter)
            throw new \Exception("Adapter property is not set");

        $adapter->check($this);
        $adapter->filter($this);
        $adapter->sort($this);
        $result = $adapter->paginate($this);

        $filters = $this->getFilters();
        return [
            'sort_column'   => $this->getSortColumn(),
            'sort_dir'      => $this->getSortDir(),
            'page_number'   => $this->getPageNumber(),
            'page_size'     => $this->getPageSize(),
            'total_pages'   => $this->getTotalPages(),
            'filters'       => count($filters) ? $filters : new \StdClass(),
            'rows'          => $result,
        ];
    }
1329835
public function first()
    {
        $sql = clone($this);
        $sql->limit(1);
        $result = $this->_adapter->query($sql, $sql->getParameters());
        return  (count($result) > 0) ? $result[0]: null;
    }
521769
private function _getResult()
    {
        $def = $this->actionChain->getCurrentAction();
        $result = $def['result'];
        if (! $result) {
            return null;
        } elseif (is_string($result)) {
            return $result;
        } elseif (is_array($result)) {
            return array_shift($result);
        } else {
            throw new Exception('invalid action result.');
        }
    }