<commit_before><?php

$rootpath    = dirname(__FILE__)."/../../";

$allowedpath = array();
//%allowedpath%

// get the wanted file path
// and check if the file is allowed to be displayed
$page = isset($_GET["p"]) ? $_GET["p"] : "";
if ($page == "") die();
$files = array();
foreach($allowedpath as $ap)
{
  $f = realpath($ap."/".$page);
  if ($f !== FALSE && file_exists($f)) $files[] = $f;
}
$found = "";
for( $i = 0; $i < count($allowedpath) && $found == ""; $i++)
{
  $ap = $allowedpath[$i];
  foreach($files as $file)
  {
    if (strpos($file, $ap) === 0 ) $found = $file;
  }
}
if (trim($found) == "")
  die();
else
  $file = $found;

$contenttype   = "text/plain";
$contentlength = filesize($file);
if (preg_match("/.js$/", $file))
  $contenttype = "text/javascript";
else if (preg_match("/.css$/", $file))
  $contenttype = "text/css";
header("Content-Length: ".$contentlength);
header("Content-Type: ".$contenttype);
session_cache_limiter('public');
echo file_get_contents($file);

?><commit_msg>[en] Bug fix: the proxy.php loading was very long with gzhandler enabled (thanks to <NAME> from http://www.freakboard.de). [fr] Bug fix : le fichier proxy.php chargait tres lentement les pages lorsque gzhandler etait active (merci a <NAME> de http://www.freakboard.de)<commit_after><?php

$rootpath    = dirname(__FILE__)."/../../";

$allowedpath = array();
//%allowedpath%

// get the wanted file path
// and check if the file is allowed to be displayed
$page = isset($_GET["p"]) ? $_GET["p"] : "";
if ($page == "") die();
$files = array();
foreach($allowedpath as $ap)
{
  $f = realpath($ap."/".$page);
  if ($f !== FALSE && file_exists($f)) $files[] = $f;
}
$found = "";
for( $i = 0; $i < count($allowedpath) && $found == ""; $i++)
{
  $ap = $allowedpath[$i];
  foreach($files as $file)
  {
    if (strpos($file, $ap) === 0 ) $found = $file;
  }
}
if (trim($found) == "")
  die();
else
  $file = $found;

$contenttype   = "text/plain";
$contentlength = filesize($file);
if (preg_match("/.js$/", $file))
  $contenttype = "text/javascript";
else if (preg_match("/.css$/", $file))
  $contenttype = "text/css";
header("Content-Length: ".$contentlength);
header("Content-Type: ".$contenttype);
session_cache_limiter('public');
echo file_get_contents($file);
flush(); // needed to fix problems with gzhandler enabled
?>
{'fraction_non_alphanumeric': 0.2293103448275862, 'fraction_numerical': 0.0017241379310344827, 'mean_word_length': 4.287015945330296, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5362237', 'n_tokens_mistral': 836, 'n_tokens_neox': 824, 'n_words': 218}