<commit_before><?php
/**
 * A class representing a HTTP request
 * @package PeanutCMS
 * @property array $path The path relative to the application root as an array
 * @property array $query The GET query as an array
 * @property string $fragment The fragment
 * @property-read array $realPath The original $path
 * @property-read array $data POST data as an array
 * @property-read Cookies $cookies Cookie access object
 * @property-read Session $session Session storage access object
 * @property-read string|null $ip The remote address or null if not set
 * @property-read string|null $url The request uri or null if not set
 * @property-read string|null $referer HTTP referer or null if not set
 */
class Request {

  private $realPath;

  private $path;

  private $query;

  private $cookies;

  private $session;

  private $fragment = null;

  private $data;

  /**
   * Initializes the request-object
   */
  public function __construct($sessionPrefix = '', $basePath = '/') {
    $url = $_SERVER['REQUEST_URI'];
       
    $request = parse_url($url);
    if (isset($request['fragment'])) {
      $this->fragment = $request['fragment'];
    }
    $path = urldecode($request['path']);
    if ($basePath != '/') {
      $l = strlen($basePath);
      if (substr($path, 0, $l) == $basePath) {
        $path = substr($path, $l);
      }
//       $path = str_replace($basePath, '', $path);
    }
    Logger::debug('Request for ' . $url . ' [' . $path . '] from ' . $this->ip);
    $path = explode('/', $path);
    $this->path = array();
    foreach ($path as $dir) {
      if (!empty($dir)) {
        $this->path[] = $dir;
      }
    }

    $this->realPath = $this->path;

    $this->query = $_GET;
    $this->data = $_POST;

    $this->cookies = new Cookies($_COOKIE, $sessionPrefix, $basePath);
    $this->session = new Session($sessionPrefix);
  }

  /**
   * Get value of property
   * @param string $name Property name
   * @return mixed Value of property
   */
  public function __get($name) {<commit_msg>0 in path bug<commit_after><?php
/**
 * A class representing a HTTP request
 * @package PeanutCMS
 * @property array $path The path relative to the application root as an array
 * @property array $query The GET query as an array
 * @property string $fragment The fragment
 * @property-read array $realPath The original $path
 * @property-read array $data POST data as an array
 * @property-read Cookies $cookies Cookie access object
 * @property-read Session $session Session storage access object
 * @property-read string|null $ip The remote address or null if not set
 * @property-read string|null $url The request uri or null if not set
 * @property-read string|null $referer HTTP referer or null if not set
 */
class Request {

  private $realPath;

  private $path;

  private $query;

  private $cookies;

  private $session;

  private $fragment = null;

  private $data;

  /**
   * Initializes the request-object
   */
  public function __construct($sessionPrefix = '', $basePath = '/') {
    $url = $_SERVER['REQUEST_URI'];
       
    $request = parse_url($url);
    if (isset($request['fragment'])) {
      $this->fragment = $request['fragment'];
    }
    $path = urldecode($request['path']);
    if ($basePath != '/') {
      $l = strlen($basePath);
      if (substr($path, 0, $l) == $basePath) {
        $path = substr($path, $l);
      }
//       $path = str_replace($basePath, '', $path);
    }
    Logger::debug('Request for ' . $url . ' [' . $path . '] from ' . $this->ip);
    $path = explode('/', $path);
    $this->path = array();
    foreach ($path as $dir) {
      if ($dir != '') {
        $this->path[] = $dir;
      }
    }

    $this->realPath = $this->path;

    $this->query = $_GET;
    $this->data = $_POST;

    $this->cookies = new Cookies($_COOKIE, $sessionPrefix, $basePath);
    $this->session = new Session($sessionPrefix);
  }

  /**
   * Get value of property
   * @param string $name Property name
   * @return mixed Value of property
   */
  public function __get($name) {
{'fraction_non_alphanumeric': 0.15062034739454094, 'fraction_numerical': 0.0007444168734491315, 'mean_word_length': 3.014940239043825, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '7561168', 'n_tokens_mistral': 1241, 'n_tokens_neox': 1206, 'n_words': 391}