/** * * @the constructor is set to private so * @so nobody can create a new instance using new * */ private function __construct() { /** * Replace forward-slashes (\) with back-slashes (/), * Remove any double-slashes (//), and any beginning or ending slashes * Remove any potentially harmful characters from the equation */ self::$uri = self::clean($_SERVER['QUERY_STRING']); /** * Check if a page is specified in the URL. * If it is, we can trim that portion from the $uri, * and attach it to the self::$page variable. */ if (preg_match('/\\/page\\/(\\d+)$/i', self::$uri, $matches, PREG_OFFSET_CAPTURE)) { self::$uri = substr(self::$uri, 0, $matches[0][1]); self::$page = !empty($matches[1][0]) ? (int) $matches[1][0] : self::$page; } /*** put the string into array ***/ self::$fragments = explode('/', self::$uri); }