Buid pages if total count is known.

@param int $numberOfPages

@return Pages
764251
protected function buildLengthAware($numberOfPages)
    {
        $pages = $this->newPages();

        if ($this->totalCount < 1) {
            return $pages;
        }

        return $this->addPages($pages, 1, $numberOfPages);

    }
1310104
protected function getPages()
    {
        $pages = $this->site->getPages();
        $additionalPageIds = [];
        if (!empty($this->indexingConfiguration['additionalPageIds'])) {
            $additionalPageIds = GeneralUtility::intExplode(',', $this->indexingConfiguration['additionalPageIds']);
        }

        $pages = array_merge($pages, $additionalPageIds);
        sort($pages, SORT_NUMERIC);

        return $pages;
    }
1322303
public function setPages(array $pages)
    {
        $this->pages = array();
        foreach ($pages as $page) {
            $this->addPage($page);
        }
        return $this;
    }
594886
public function getPage(int $pageNumber)
    {
        $pages = $this->getPages();

        if (isset($pages[$pageNumber - 1])) {
            return $pages[$pageNumber - 1];
        }

        return null;
    }
172635
public function calculatePageParams($rowCount)
    {
        $this->totalPages = $this->pageSize > 0
            ? ceil($rowCount / $this->pageSize)
            : 1;
        if ($this->totalPages <= 0)
            $this->totalPages = 1;
        if ($this->pageNumber > $this->totalPages)
            $this->pageNumber = $this->totalPages;

        return $this;
    }
459776
public function get($objects, $pages = null) {
		$objects = $this->getDatas ( $objects );
		return $this->format ( [ "datas" => $objects,"count" => \sizeof ( $objects ) ] );
	}
1188739
public function pageCount($onlyCompleted = false)
    {
        if ($onlyCompleted) {
            $count = 0;
            foreach ($this->data['pages'] as $page) {
                if ($page['completed']) {
                    $count++;
                }
            }
        } else {
            $count = \count($this->data['pages']);
        }
        return $count;
    }
32675
public function getPageCount() : int
    {
        return intval($this->count / $this->pageSize) + ($this->count % $this->pageSize == 0 ? 0 : 1);
    }
22333
public function Pages()
    {
        $pages = SiteTree::get();
        $types = $this->PageTypes->getValue();
        if (count($types)) {
            $pages = $pages->filter('ClassName', $types);
        }

        $parents = $this->PageParents()->column('ID');
        if (count($parents)) {
            $pages = $pages->filter('ParentID', $parents);
        }

        return $pages;
    }
137700
public function getPagedResults($limit = 25, $page = 0)
    {
        $template = self::DQL_ALL;
        $dql = sprintf($template, Application::class);

        return $this->getPaginator($dql, $limit, $page, []);
    }
267547
private function calculateNumberOfDays($numberOfDays)
    {
        $endDate = Carbon::today();
        $startDate = Carbon::today()->subDays($numberOfDays);

        return [$startDate, $endDate];
    }
735854
public function totalPages()
    {
        $link = $this->_doc->navigation('self');
        return ($link && isset($link->totalpages)) ? $link->totalpages : 1;
    }
442938
public function getPage($pageNumber)
    {
        $response = $this->makeQuery($pageNumber);
        $className = $this->typeClass->objectClass;
        $objects = array();
        if (!isset($response->data) || !$response->data)
            return array();
        foreach ($response->data as $object) {
            $objects[] = new $className($this->api, $this->typeClass, $object);
        }

        return $objects;
    }
391462
public function addPages( $pages ) {
		if( !is_array( $pages ) && !$pages instanceof Pages ) {
			throw new InvalidArgumentException( '$pages needs to either be an array or a Pages object' );
		}
		if( $pages instanceof Pages ) {
			$pages = $pages->toArray();
		}
		foreach( $pages as $page ) {
			$this->addPage( $page );
		}
	}
249296
protected function getPages($total, $limit = null, $current = null, $adjacents = null)
    {
        $result = array();

        if (isset($total, $limit) === true)
        {
            $result = range(1, ceil($total / $limit));

            if (isset($current, $adjacents) === true)
            {
                if (($adjacents = floor($adjacents / 2) * 2 + 1) >= 1)
                {
                    $result = array_slice($result, max(0, min(count($result) - $adjacents, intval($current) - ceil($adjacents / 2))), $adjacents);
                }
            }
        }

        return $result;
    }
529735
private static function getNumPages(int $limit, int $count): int
    {
        return (int) ceil($count / $limit);
    }
346635
final public function page($pageNumber, $recordsPerPage = null)
    {
        $recordsPerPage = $recordsPerPage ?? $this->recordsPerPage;

        $this->getQuery()->limit(((int)$pageNumber) * $recordsPerPage, $recordsPerPage);
        $this->pagedQuery = true;

        return $this;
    }