<commit_before><?php

session_start();

$dir = opendir(dirname(__FILE__) . '/data/');

// delete old screenshots
if($dir) {
    // read directory contents
    while(false !== ($file = readdir($dir))) {
        // check the create time of each file (older than 1 hour)
        if(filemtime($file) < time() - 3600) {
            unlink($file);
        }
    }
}
     
$data = '';

$feedback  = 'Server Datum/Zeit: ' . date('d.m.Y - H:i:s') . ' (Beginn Zusammenstellung E-Mail - Server)' . "\n\n";
$feedback .= 'Client Datum/Zeit: ' . date('d.m.Y - H:i:s', strtotime($_POST['datetime'])) . ' (Beginn Feedback-Versand - Client)' . "\n\n";
$feedback .= 'Client Browser: ' . $_POST['useragent'] . "\n\n";
$feedback .= 'Client Betriebssystem: ' . $_POST['platform'] . "\n\n";

$feedback .= 'Feedback: ' . "\n\n" . $_POST['feedback'];

if(isset($_POST['screenshot'])){
    $data = base64_decode(preg_replace('/^data:image\/jpeg;base64,/', '', $_POST['screenshot']));
}

// attach ScreenShot
file_put_contents($dir . session_id() . '.jpg', $data);

$_SESSION['screenshot'] = session_id() . '.jpg';
$_SESSION['feedback'] = $feedback;


echo json_encode(array(
    'success' => true,
    'msg'     => ''<commit_msg>demo bug fix<commit_after><?php

session_start();

$dir = opendir(dirname(__FILE__) . '/data/');
$filename = session_id() . time() . '.jpg'

// delete old screenshots
if($dir) {
    // read directory contents
    while(false !== ($file = readdir($dir))) {
        // check the create time of each file (older than 1 hour)
        if(filemtime($file) < time() - 3600) {
            unlink($file);
        }
    }
}
     
$data = '';

$feedback  = 'Server Datum/Zeit: ' . date('d.m.Y - H:i:s') . ' (Beginn Zusammenstellung E-Mail - Server)' . "\n\n";
$feedback .= 'Client Datum/Zeit: ' . date('d.m.Y - H:i:s', strtotime($_POST['datetime'])) . ' (Beginn Feedback-Versand - Client)' . "\n\n";
$feedback .= 'Client Browser: ' . $_POST['useragent'] . "\n\n";
$feedback .= 'Client Betriebssystem: ' . $_POST['platform'] . "\n\n";

$feedback .= 'Feedback: ' . "\n\n" . $_POST['feedback'];

if(isset($_POST['screenshot'])){
    $data = base64_decode(preg_replace('/^data:image\/jpeg;base64,/', '', $_POST['screenshot']));
}

// attach ScreenShot
file_put_contents($dir . $filename, $data);

$_SESSION['screenshot'] = $filename;
$_SESSION['feedback'] = $feedback;


echo json_encode(array(
    'success' => true,
    'msg'     => ''
{'fraction_non_alphanumeric': 0.2262984336356142, 'fraction_numerical': 0.00741962077493817, 'mean_word_length': 3.2804232804232805, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1992303', 'n_tokens_mistral': 906, 'n_tokens_neox': 873, 'n_words': 174}