<commit_before><?php

date_default_timezone_set('America/Los_Angeles');
$month =  date('Ym');
$uploadPlace_ = '/home/MM/corelogUploads/' . $month;
if (!file_exists($uploadPlace_)) 
{
   mkdir($uploadPlace_, 0750);
}

if ($_FILES['file']['error'] > 0)
{
  echo 'Return Code: ' . $_FILES['file']['error'] . '<br />';
}
else
{
   // echo 'Upload: ' . $_FILES['file']['name'] . '<br />';
   // echo 'Type: ' . $_FILES['file']['type'] . '<br />';
   // echo 'Size: ' . ($_FILES['file']['size'] / 1024) . ' Kb<br />';
   // echo 'Temp file: ' . $_FILES['file']['tmp_name'] . '<br />';
   $ipaddress = getenv(REMOTE_ADDR);

   if (strlen($_FILES['file']['name']) < 1) {
      return;
   }

   $opath = $uploadPlace_ . '/'. $_FILES['file']['name'] . '_' . $ipaddress;

   if (file_exists($opath . '.uu' ))
   {
      echo $_FILES['file']['name'] . ' already exists. ';
   }
   else
   {
      move_uploaded_file($_FILES['file']['tmp_name'],
      $opath . '.uu');
      echo 'Stored in: ' . $opath . '.uu  <br />';
      $dcommand = 'uudecode -o ' . $opath . '.gz ' . $opath . '.uu';
      echo 'decode command: ' . $dcommand . '<br />';
      exec( $dcommand);
      $gcommand = 'gzip -d ' . $opath . '.gz';
      echo 'gzip command:  ' . $gcommand . '<br />';
      exec( $gcommand);
      $rcommand = 'rm ' . $opath . '.uu';
      exec( $rcommand);

      $mess = $opath . "\n" ;
      // extract beginning of report
      $rhandle = fopen( $opath, 'r');
      $lineCount = 0;
      if ($rhandle){
      while(! feof($rhandle) ){
           $line = fgets($rhandle);
           $username_tag = "#User Name:";
           if (strcmp(substr($line, 0, strlen($username_tag)), $username_tag) == 0)
              $username = trim(substr($line, strlen($username_tag), 36));
           $user_email_tag = "#User e-mail:";
           if (strcmp(substr($line, 0, strlen($user_email_tag)), $user_email_tag) == 0)
              $user_email = trim(substr($line, strlen($user_email_tag), 256));
           $mess = $mess . rtrim($line) . "\n";
           $lineCount = $lineCount + 1;
           if( 2000 < $lineCount)
               break 1;
           }
       } 
       fclose($rhandle);
       
       $subject = "New Problem Report: " . date("Y-m-d") . " " . $username;
       $header = "Reply-To: ".$user_email."\r\n";
       mail('<EMAIL>', $subject, $mess, $header);
<commit_msg>Increase hard coded limit in upload script from 2000 to 10000<commit_after><?php

date_default_timezone_set('America/Los_Angeles');
$month =  date('Ym');
$uploadPlace_ = '/home/MM/corelogUploads/' . $month;
if (!file_exists($uploadPlace_)) 
{
   mkdir($uploadPlace_, 0750);
}

if ($_FILES['file']['error'] > 0)
{
  echo 'Return Code: ' . $_FILES['file']['error'] . '<br />';
}
else
{
   // echo 'Upload: ' . $_FILES['file']['name'] . '<br />';
   // echo 'Type: ' . $_FILES['file']['type'] . '<br />';
   // echo 'Size: ' . ($_FILES['file']['size'] / 1024) . ' Kb<br />';
   // echo 'Temp file: ' . $_FILES['file']['tmp_name'] . '<br />';
   $ipaddress = getenv(REMOTE_ADDR);

   if (strlen($_FILES['file']['name']) < 1) {
      return;
   }

   $opath = $uploadPlace_ . '/'. $_FILES['file']['name'] . '_' . $ipaddress;

   if (file_exists($opath . '.uu' ))
   {
      echo $_FILES['file']['name'] . ' already exists. ';
   }
   else
   {
      move_uploaded_file($_FILES['file']['tmp_name'],
      $opath . '.uu');
      echo 'Stored in: ' . $opath . '.uu  <br />';
      $dcommand = 'uudecode -o ' . $opath . '.gz ' . $opath . '.uu';
      echo 'decode command: ' . $dcommand . '<br />';
      exec( $dcommand);
      $gcommand = 'gzip -d ' . $opath . '.gz';
      echo 'gzip command:  ' . $gcommand . '<br />';
      exec( $gcommand);
      $rcommand = 'rm ' . $opath . '.uu';
      exec( $rcommand);

      $mess = $opath . "\n" ;
      // extract beginning of report
      $rhandle = fopen( $opath, 'r');
      $lineCount = 0;
      if ($rhandle){
      while(! feof($rhandle) ){
           $line = fgets($rhandle);
           $username_tag = "#User Name:";
           if (strcmp(substr($line, 0, strlen($username_tag)), $username_tag) == 0)
              $username = trim(substr($line, strlen($username_tag), 36));
           $user_email_tag = "#User e-mail:";
           if (strcmp(substr($line, 0, strlen($user_email_tag)), $user_email_tag) == 0)
              $user_email = trim(substr($line, strlen($user_email_tag), 256));
           $mess = $mess . rtrim($line) . "\n";
           $lineCount = $lineCount + 1;
           if( 10000 < $lineCount)
               break 1;
           }
       } 
       fclose($rhandle);
       
       $subject = "New Problem Report: " . date("Y-m-d") . " " . $username;
       $header = "Reply-To: ".$user_email."\r\n";
       mail('<EMAIL>', $subject, $mess, $header);

{'fraction_non_alphanumeric': 0.22273393343102366, 'fraction_numerical': 0.012978857023236342, 'mean_word_length': 2.311157311157311, 'pattern_counts': {'":': 0, '<': 27, '<?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': '741368', 'n_tokens_mistral': 1750, 'n_tokens_neox': 1655, 'n_words': 346}