<commit_before><?hh

namespace LotGD\Census;

function DOMinnerHTML(\DOMNode $element)
{
    $innerHTML = "";
    $children  = $element->childNodes;

    foreach ($children as $child)
    {
        $innerHTML .= $element->ownerDocument->saveHTML($child);
    }

    return $innerHTML;
}

enum WarriorsPageState: int {
  Unknown = 0;
  Valid = 1;
  End = 2;
  Error = 3;
}

class WarriorsPage {
  public ?Stats $stats;
  public WarriorsPageState $state;

  private \Monolog\Logger $logger;

  public function __construct(\Monolog\Logger $logger, string $url, string $contents) {
    $this->logger = $logger;
    $this->state = WarriorsPageState::Unknown;

    // Some light preprocessing.
    $contents = str_replace('&nbsp;', ' ', $contents);

    $doc = new \DOMDocument();
    $doc->loadHTML($contents);
    $this->state = $this->computeStats($doc, $url);
  }

  private function getTimeFromString(string $t) : int {
    $max = PHP_INT_MAX;

    $t = trim($t);
    // Some cruft sometimes appears.
    $t = str_replace('.', '', $t);

    $t = str_replace('Today', '0 days', $t);
    $t = str_replace('Heute', '0 days', $t);
    $t = str_replace('Gastern', '1 days', $t);

    $t = str_replace('Never', "{$max} days", $t);
    $t = str_replace('Nie', "{$max} days", $t);

    $i = intval($t);

    // Handle some odd data, like -67242 days.
    if ($i < 0) {
      $i = PHP_INT_MAX;
    }

    return $i;<commit_msg>Fixing German typo<commit_after><?hh

namespace LotGD\Census;

function DOMinnerHTML(\DOMNode $element)
{
    $innerHTML = "";
    $children  = $element->childNodes;

    foreach ($children as $child)
    {
        $innerHTML .= $element->ownerDocument->saveHTML($child);
    }

    return $innerHTML;
}

enum WarriorsPageState: int {
  Unknown = 0;
  Valid = 1;
  End = 2;
  Error = 3;
}

class WarriorsPage {
  public ?Stats $stats;
  public WarriorsPageState $state;

  private \Monolog\Logger $logger;

  public function __construct(\Monolog\Logger $logger, string $url, string $contents) {
    $this->logger = $logger;
    $this->state = WarriorsPageState::Unknown;

    // Some light preprocessing.
    $contents = str_replace('&nbsp;', ' ', $contents);

    $doc = new \DOMDocument();
    $doc->loadHTML($contents);
    $this->state = $this->computeStats($doc, $url);
  }

  private function getTimeFromString(string $t) : int {
    $max = PHP_INT_MAX;

    $t = trim($t);
    // Some cruft sometimes appears.
    $t = str_replace('.', '', $t);

    $t = str_replace('Today', '0 days', $t);
    $t = str_replace('Heute', '0 days', $t);
    $t = str_replace('Gestern', '1 days', $t);

    $t = str_replace('Never', "{$max} days", $t);
    $t = str_replace('Nie', "{$max} days", $t);

    $i = intval($t);

    // Handle some odd data, like -67242 days.
    if ($i < 0) {
      $i = PHP_INT_MAX;
    }

    return $i;
{'fraction_non_alphanumeric': 0.17611835153222966, 'fraction_numerical': 0.009158154279675942, 'mean_word_length': 3.0398293029871977, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, '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': '3798554', 'n_tokens_mistral': 1017, 'n_tokens_neox': 961, 'n_words': 243}