<commit_before><?php

// To start the server, tested on PHP 5.5.9.
// $ php -S localhost:8000 server.php
//
// To test it from bash:
// $ curl -s -w "\n%{http_code}\n" -d '{"a":1,"b":42}' localhost:8000/add
//
// The rest is F#.

define("LOG_FILENAME", "php-log.txt");

function appendToLog($ref, $s) {
  $f = fopen(LOG_FILENAME, "a") or die("Cannot open '" . LOG_FILENAME . "' for appending.\n");
  fwrite($f, $ref . date(" @ Y/m/d, H:i:s :: ") . $s . "\n");
  fclose($f);
};

$ref = "rs-" . date("YmdHis") . "-" . rand(1000, 9999);
appendToLog($ref, "Starting request.");

http_response_code(500);
header('Content-type: application/json');

if ($_SERVER["REQUEST_METHOD"] != "POST") {<commit_msg>Verified it works on Windows.<commit_after><?php

// To start the server, tested on PHP 5.5.9.
// $ php -S localhost:8000 server.php
//
// To test it from bash:
// $ curl -s -w "\n%{http_code}\n" -d '{"a":1,"b":42}' localhost:8000/add
//
// For PHP, on Linux, you'll need:
// $ sudop apt-get install php5-json
//
// For PHP, on Windows/Cygwin, you'll need:
// $ apt-cyg install php-json
//
// The rest is F#.

define("LOG_FILENAME", "php-log.txt");

date_default_timezone_set("America/Los_Angeles");

function appendToLog($ref, $s) {
  $f = fopen(LOG_FILENAME, "a") or die("Cannot open '" . LOG_FILENAME . "' for appending.\n");
  fwrite($f, $ref . date(" @ Y/m/d, H:i:s :: ") . $s . "\n");
  fclose($f);
};

$ref = "rs-" . date("YmdHis") . "-" . rand(1000, 9999);
appendToLog($ref, "Starting request.");

http_response_code(500);
header('Content-type: application/json');

if ($_SERVER["REQUEST_METHOD"] != "POST") {
{'fraction_non_alphanumeric': 0.23281733746130032, 'fraction_numerical': 0.031578947368421054, 'mean_word_length': 3.552112676056338, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 3, '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': '5867760', 'n_tokens_mistral': 680, 'n_tokens_neox': 626, 'n_words': 154}