<commit_before><?php

function pxlog($data, $section = "", $id = "")
{
  $msg = htmlspecialchars(stripslashes(var_export($data, true)));
  $filename = dirname(__FILE__)."/../data/private/debug".$section."_".$id.".log";
  if (!file_exists($filename))
    @touch($filename);
  $fp = @fopen($filename, 'a');
  @fwrite($fp, "[".$id."] ".date("Y/m/d H:i:s - ").$msg."\n");
  @fclose($fp);
}
<commit_msg>Updated pxlog function to use file_put_contents and honor file locking.<commit_after><?php

function pxlog($data, $section = "", $id = "")
{
  $msg = htmlspecialchars(stripslashes(var_export($data, true)));
  $filename = dirname(__FILE__)."/../data/private/debug".$section."_".$id.".log";

  @file_put_contents($filename, "[".$id."] ".date("Y/m/d H:i:s - ").$msg."\n", FILE_APPEND | LOCK_EX);
}

{'fraction_non_alphanumeric': 0.25598991172761665, 'fraction_numerical': 0.0, 'mean_word_length': 4.795620437956204, 'pattern_counts': {'":': 0, '<': 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': '2301422', 'n_tokens_mistral': 303, 'n_tokens_neox': 303, 'n_words': 48}