Get the url for a specified page number.


@param int $page The page number to build a link to.

@return string
323069
public function getPageUrl($page){
        $qs = '';
        if($_SERVER['QUERY_STRING']){
            $qs = '?' . $_SERVER['QUERY_STRING'];
        }//if
        return str_replace($this->fromFormat($this->currentPage),$this->fromFormat($page),$this->uri) . $qs;
    }
168025
private function getPage(Request $request)
    {
        $page = $request->query->get('page', 1);
        if (!is_numeric($page) || $page < 1) {
            $page = 1;
        }

        return (int)$page;
    }
803821
public static Url getPageUrl(final Page page, final PageParameters parameters)
	{
		return getPageUrl(page.getPageClass(), parameters);
	}
19381
public function generate($page = null)
    {
        $this->__build();
        parent::generate($page);
        return $this->Html->generate(true);
    }
783680
public function getPageLinkWrapper($url, $page, $rel = null)
    {
        $rel = is_null($rel) ? '' : ' rel="'.$rel.'"';
        $class = Config::get('pagination::scroll.infinite_more_link_class');

        return '<li><a class='.$class.' href="'.$url.'"'.$rel.'>'.$page.'</a></li>';
    }
772736
public function getRedirect($url)
    {
        $pages = $this->getRedirects();
        $url = $this->normalizeUrl($url);

        if (isset($pages[$url])) {
            return $pages[$url];
        }
    }
1020505
public function getPage(int $number): self
    {
        return $this->loadPage($this->links->expand(self::REL_PAGE, [self::PAGE_VARIABLE => $number]));
    }
374558
protected function _getPaginatedUrl($page)
    {
        $url = $this->_getSortUrl();

        if ($page > 1) {
            if (!isset($url['?'])) {
                $url['?'] = [];
            }
            $url['?']['p'] = $page;
        }

        return $url;
    }
980381
public static function giveMeLinks($page) {
		$result = [];
		$pattern = "/<a \s [^<]*? href \s*  = \s* (['|\"]) \s* ([^\\1]*?) (\\1) .*? > (.*?) <\/a\s*>/xis";

		if (preg_match_all($pattern, $page, $subject, PREG_SET_ORDER)) {
			foreach ($subject as $e) {
				$result[] = [
					'href' => $e[2],
					'anchor' => $e[4]
				];
			}
		}

		$subject = [];
		$pattern = "/<a \s [^<]*? href \s* = \s*([^'\"]+?) ( (\s[^>]*? >) | > ) (.*?) <\/a\s*>/xis";
		if (preg_match_all($pattern, $page, $subject, PREG_SET_ORDER)) {
			foreach ($subject as $e) {
				if (!in_array($e[1], \Set::extract('{n}.href', $result))) {
					$result[] = [
						'href' => $e[1],
						'anchor' => $e[4]
					];
				}
			}
		}
		return $result;
	}
137700
public function getPagedResults($limit = 25, $page = 0)
    {
        $template = self::DQL_ALL;
        $dql = sprintf($template, Application::class);

        return $this->getPaginator($dql, $limit, $page, []);
    }
839689
private function url($page)
	{
		$param=$this->param;
		$param[$this->pageField]=$page;
		echo Dispatch::url($this->rule,$param);
	}
955615
public function getLink($page, $header = null)
    {
        $id = preg_replace('/[^a-z0-9\/]+/i', '', $page);
        $link = $this->getBaseUrl() . '/' . $id;

        if ($header !== null) {
            $link .= '#' . $this->createId($header);
        } else if ($id == 'index') {
            $link = $this->getBaseUrl();
        }

        return $link;
    }
688775
private function generateAddUrl(array $page): string
    {
        $event = new GenerateFrontendUrlEvent($page, null, $page['language']);

        $this->dispatcher->dispatch(ContaoEvents::CONTROLLER_GENERATE_FRONTEND_URL, $event);

        $url = UrlBuilder::fromUrl($event->getUrl() . '?')
            ->setQueryParameter('act', 'create');

        return $url->getUrl();
    }
949245
public function getLinkForPage($page)
    {
        return $page->Link() . "article/" . $this->HailID . '/' . Convert::raw2url($this->Title);
    }
1322638
public function generatePermalink($page)
    {
        if (!$page->isHybrid() && !$page->isInternal()) {
            try {
                $path = $page->getUrl();
                $siteRelativePath = $page->getSite()->getRelativePath();
                if (!empty($siteRelativePath)) {
                    $path = $siteRelativePath . $path;
                }

                return $this->getRouteGenerator()->generate(
                    'page_slug',
                    [
                        'path' => $path,
                    ]
                );
            } catch (\Exception $e) {
                // avoid crashing the admin if the route is not setup correctly
                // throw $e;
            }
        }

        return '';
    }
892540
public function getPage($page) {
			if (array_key_exists($page, $this->pageCache))
				return $this->pageCache[$page];

			if (!file_exists(sprintf('%s/pages/%s.php', $this->getPluginRoot(), $page)))
				return '<div><strong>Page not found.</strong></div>';
			else {
				ob_start();

				include sprintf('%s/pages/%s.php', $this->getPluginRoot(), $page);

				$data = ob_get_clean();
			}

			$this->pageCache[$page] = $data;

			return $data;
		}
1366896
protected function _make_link($page)
	{
		// make sure we have a valid page number
		empty($page) and $page = 1;

		// construct a pagination url if we don't have one
		if (is_null($this->config['pagination_url']))
		{
			// start with the main uri
			$this->config['pagination_url'] = \Uri::main();
			\Input::get() and $this->config['pagination_url'] .= '?'.http_build_query(\Input::get());
		}

		// was a placeholder defined in the url?
		if (strpos($this->config['pagination_url'], '{page}') === false)
		{
			// break the url in bits so we can insert it
			$url = parse_url($this->config['pagination_url']);

			// parse the query string
			if (isset($url['query']))
			{
				parse_str($url['query'], $url['query']);
			}
			else
			{
				$url['query'] = array();
			}

			// do we have a segment offset due to the base_url containing segments?
			$seg_offset = parse_url(rtrim(\Uri::base(), '/'));
			$seg_offset = empty($seg_offset['path']) ? 0 : count(explode('/', trim($seg_offset['path'], '/')));

			// is the page number a URI segment?
			if (is_numeric($this->config['uri_segment']))
			{
				// get the URL segments
				$segs = isset($url['path']) ? explode('/', trim($url['path'], '/')) : array();

				// do we have enough segments to insert? we can't fill in any blanks...
				if (count($segs) < $this->config['uri_segment'] - 1)
				{
					throw new \RuntimeException("Not enough segments in the URI, impossible to insert the page number");
				}

				// replace the selected segment with the page placeholder
				$segs[$this->config['uri_segment'] - 1 + $seg_offset] = '{page}';
				$url['path'] = '/'.implode('/', $segs);
			}
			else
			{
				// add our placeholder
				$url['query'][$this->config['uri_segment']] = '{page}';
			}

			// re-assemble the url
			$query = empty($url['query']) ? '' : '?'.preg_replace('/%7Bpage%7D/', '{page}', http_build_query($url['query'], '', '&amp;'));
			unset($url['query']);
			empty($url['scheme']) or $url['scheme'] .= '://';
			empty($url['port']) or $url['host'] .= ':';
			$this->config['pagination_url'] = implode($url).$query;
		}

		// return the page link
		return str_replace('{page}', $page, $this->config['pagination_url']);
	}