src/data/Pagination.php
public function createUrl($page, $pageSize = null, $absolute = false)
    {
        $page = (int) $page;
        $pageSize = (int) $pageSize;
        if (($params = $this->params) === null) {
            $request = Yii::getApp()->getRequest();
            $params = $request instanceof Request ? $request->getQueryParams() : [];
        }
        if ($page > 0 || $page == 0 && $this->forcePageParam) {
            $params[$this->pageParam] = $page + 1;
        } else {
            unset($params[$this->pageParam]);
        }
        if ($pageSize <= 0) {
            $pageSize = $this->getPageSize();
        }
        if ($pageSize != $this->defaultPageSize) {
            $params[$this->pageSizeParam] = $pageSize;
        } else {
            unset($params[$this->pageSizeParam]);
        }
        $params[0] = $this->route ?? Yii::getApp()->controller->getRoute();
        $urlManager = $this->urlManager ?? Yii::getApp()->getUrlManager();
        if ($absolute) {
            return $urlManager->createAbsoluteUrl($params);
        }

        return $urlManager->createUrl($params);
    }
public function createUrl($page, $pageSize = null, $absolute = false)
    {
        $page = (int) $page;
        $pageSize = (int) $pageSize;
        if (($params = $this->params) === null) {
            $request = Yii::getApp()->getRequest();
            $params = $request instanceof Request ? $request->getQueryParams() : [];
        }
        if ($page > 0 || $page == 0 && $this->forcePageParam) {
            $params[$this->pageParam] = $page + 1;
        } else {
            unset($params[$this->pageParam]);
        }
        if ($pageSize <= 0) {
            $pageSize = $this->getPageSize();
        }
        if ($pageSize != $this->defaultPageSize) {
            $params[$this->pageSizeParam] = $pageSize;
        } else {
            unset($params[$this->pageSizeParam]);
        }
        $params[0] = $this->route ?? Yii::getApp()->controller->getRoute();
        $urlManager = $this->urlManager ?? Yii::getApp()->getUrlManager();
        if ($absolute) {
            return $urlManager->createAbsoluteUrl($params);
        }

        return $urlManager->createUrl($params);
    }
public function createUrl ( $ page , $ pageSize = null , $ absolute = false ) { $ page = ( int ) $ page ; $ pageSize = ( int ) $ pageSize ; if ( ( $ params = $ this -> params ) === null ) { $ request = Yii :: getApp ( ) -> getRequest ( ) ; $ params = $ request instanceof Request ? $ request -> getQueryParams ( ) : [ ] ; } if ( $ page > 0 || $ page == 0 && $ this -> forcePageParam ) { $ params [ $ this -> pageParam ] = $ page + 1 ; } else { unset ( $ params [ $ this -> pageParam ] ) ; } if ( $ pageSize <= 0 ) { $ pageSize = $ this -> getPageSize ( ) ; } if ( $ pageSize != $ this -> defaultPageSize ) { $ params [ $ this -> pageSizeParam ] = $ pageSize ; } else { unset ( $ params [ $ this -> pageSizeParam ] ) ; } $ params [ 0 ] = $ this -> route ?? Yii :: getApp ( ) -> controller -> getRoute ( ) ; $ urlManager = $ this -> urlManager ?? Yii :: getApp ( ) -> getUrlManager ( ) ; if ( $ absolute ) { return $ urlManager -> createAbsoluteUrl ( $ params ) ; } return $ urlManager -> createUrl ( $ params ) ; }
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 int $page the zero-based page number that the URL should point to.
@param int $pageSize the number of items on each page. If not set, the value of [[pageSize]] will be used.
@param bool $absolute whether to create an absolute URL. Defaults to `false`.
@return string the created URL
@see params
@see forcePageParam
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 .