public static function buildUrl($params, $file = null)
 {
     if ($file === null) {
         if (!empty($params['_file'])) {
             $file = $params['_file'];
             unset($params['_file']);
         } else {
             $file = 'fajr.php';
         }
     }
     $path = '';
     if (FajrConfig::get('URL.Path')) {
         $path = FajrRouter::paramsToPath($params);
     }
     $query = http_build_query($params);
     if (strlen($query) > 0) {
         $query = '?' . $query;
     }
     $base = '';
     if (!FajrConfig::get('URL.Rewrite') || $file != 'fajr.php' || $path == '' || $path == '/') {
         $base = $file;
         if (strlen($path) > 0) {
             $base .= '/';
         }
     }
     return self::basePath() . $base . $path . $query;
 }