<commit_before><?php
  $routes = array();

  function setRoute($src, $dest, $includeSrc = true) {
    array_push($GLOBALS['routes'], array('route' => $src, 'redirect' => $dest, 'includeSrc' => $includeSrc));
  }

  function redirect($to, $includeSrc = true) {
    $redirectTo = $includeSrc ? __SRC__ . $to : $to;
    include_this($redirectTo);
    exit();
  }

  function redirectError($to) {
    redirect(__ERROR__.NOT_FOUND, false);
  }

  function route($r) {
    $paths = explode('/', $r);
    if (count($paths) === 0 || in_array($paths[0], ROOTPAGE_ROUTES)) {
      redirect(ROOTPAGE);
    } else {
      foreach ($GLOBALS['routes'] as $value) {
        if (preg_match("#^$paths[0]#", $value['route']) === 1) {
          $params = explode('/', $value['route']);
          for ($i = 1; $i < count($params); $i++) {
            $_GET[ltrim($params[$i], ':')] = $paths[$i];
          }
          redirect($value['redirect'] . '.php', $value['includeSrc']);
        }
      }
    }
    redirectError(NOT_FOUND);
  }
?><commit_msg>minor bug fixed.<commit_after><?php
  $routes = array();

  function setRoute($src, $dest, $includeSrc = true) {
    array_push($GLOBALS['routes'], array('route' => $src, 'redirect' => $dest, 'includeSrc' => $includeSrc));
  }

  function redirect($to, $includeSrc = true) {
    $redirectTo = $includeSrc ? __SRC__ . $to : $to;
    include_this($redirectTo);
    exit();
  }

  function redirectError($to) {
    redirect(__ERROR__.NOT_FOUND, false);
  }

  function route($r) {
    $paths = explode('/', $r);
    if (count($paths) === 0 || in_array($paths[0], ROOTPAGE_ROUTES)) {
      redirect(ROOTPAGE);
    } else {
      foreach ($GLOBALS['routes'] as $value) {
        if ($paths[0] == explode('/', $value['route'])[0]) {
          $params = explode('/', $value['route']);
          for ($i = 1; $i < count($params); $i++) {
            $_GET[ltrim($params[$i], ':')] = $paths[$i];
          }
          redirect($value['redirect'] . '.php', $value['includeSrc']);
        }
      }
    }
    redirectError(NOT_FOUND);
  }
?>
{'fraction_non_alphanumeric': 0.2183406113537118, 'fraction_numerical': 0.0048520135856380394, 'mean_word_length': 2.973025048169557, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7634386', 'n_tokens_mistral': 702, 'n_tokens_neox': 693, 'n_words': 132}