/** * Creates the URL suitable for pagination with the specified page number. * This method is mainly called by pagers when creating URLs used to perform pagination. * @param integer $page the zero-based page number that the URL should point to. * @param null $limit * @return string the created URL * @throws \rock\url\UrlException */ public function createUrl($page, $limit = null) { $params = [$this->pageParam => (int) $page]; $limit = (int) $limit; if ($limit <= 0) { $limit = $this->getLimit(); } if ($limit != $this->defaultLimit) { $params[$this->limitParam] = $limit; } else { unset($params[$this->limitParam]); } if (is_array($this->url)) { return Url::modify(array_merge($this->url, $params)); } elseif ($this->url instanceof Url) { return $this->url->setQueryParams($params)->get(); } return Url::modify($params); }