source/Application/Controller/FrontendController.php
protected function _addPageNrParam($url, $page, $languageId = null)
    {
        if ($page) {
            if ((strpos($url, 'pgNr='))) {
                $url = preg_replace('/pgNr=[0-9]*/', 'pgNr=' . $page, $url);
            } else {
                $url .= ((strpos($url, '?') === false) ? '?' : '&amp;') . 'pgNr=' . $page;
            }
        } else {
            $url = preg_replace('/pgNr=[0-9]*/', '', $url);
            $url = preg_replace('/\&amp\;\&amp\;/', '&amp;', $url);
            $url = preg_replace('/\?\&amp\;/', '?', $url);
            $url = preg_replace('/\&amp\;$/', '', $url);
        }

        return $url;
    }
protected function _addPageNrParam($url, $page, $languageId = null)
    {
        if ($page) {
            if ((strpos($url, 'pgNr='))) {
                $url = preg_replace('/pgNr=[0-9]*/', 'pgNr=' . $page, $url);
            } else {
                $url .= ((strpos($url, '?') === false) ? '?' : '&amp;') . 'pgNr=' . $page;
            }
        } else {
            $url = preg_replace('/pgNr=[0-9]*/', '', $url);
            $url = preg_replace('/\&amp\;\&amp\;/', '&amp;', $url);
            $url = preg_replace('/\?\&amp\;/', '?', $url);
            $url = preg_replace('/\&amp\;$/', '', $url);
        }

        return $url;
    }
protected function _addPageNrParam ( $ url , $ page , $ languageId = null ) { if ( $ page ) { if ( ( strpos ( $ url , 'pgNr=' ) ) ) { $ url = preg_replace ( '/pgNr=[0-9]*/' , 'pgNr=' . $ page , $ url ) ; } else { $ url .= ( ( strpos ( $ url , '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr=' . $ page ; } } else { $ url = preg_replace ( '/pgNr=[0-9]*/' , '' , $ url ) ; $ url = preg_replace ( '/\&amp\;\&amp\;/' , '&amp;' , $ url ) ; $ url = preg_replace ( '/\?\&amp\;/' , '?' , $ url ) ; $ url = preg_replace ( '/\&amp\;$/' , '' , $ url ) ; } return $ url ; }
Adds page number parameter to url and returns modified url, if page number 0 drops from url

@param string $url        Url to add page number
@param int    $page       Active page number
@param int    $languageId Language id

@return string
Adds page number parameter to url and returns modified url if page number 0 drops from url