<commit_before><?php

/**
 * Load aliases
 * @param array $aliases 
 * @return
 */
function loadAliases(array $aliases) {
	foreach ($aliases as $alias => $className) {
		class_alias($className, $alias);
	}
}

/**
 * Parse configuration data in object
 * @param string $configData 
 * @return StdClass Config object
 */
function parseConfigData($configData) {
	preg_match_all('/([^\s:]+)[\s:]+(.+)/', $configData, $matches);

	$conf = new \StdClass();
	for ($i = 0; $i <= count($matches); ++$i) { 
		$conf->{$matches[1][$i]} = trim($matches[2][$i]);
	}

	return $conf;
}

/**
 * Handle exceptions
 * @param Exception $e
 * @return
 */
function exceptionHandler(Exception $e) {
	// @header("Content-Type:text/plain");

	echo "<h1 style='font-size:24px'>Error</h1>\n",
	"<pre style='background:#f8f8f8;padding:8px'>\n",
	'<b>Caught ', basename(str_replace('\\', '/', get_class($e))),
	': "', $e->getMessage(), '"</b> (', $e->getFile(), ':', $e->getLine(), ")\n\n",
	'<span style="color:#811">', $e->getTraceAsString(), "</span>",
	"\n</pre>";

	exit;
}

set_exception_handler('exceptionHandler');
<commit_msg>add uidSession()<commit_after><?php

/**
 * Load aliases
 * @param array $aliases
 * @return
 */
function loadAliases(array $aliases) {
	foreach ($aliases as $alias => $className) {
		class_alias($className, $alias);
	}
}

/**
 * Parse configuration data in object
 * @param string $configData
 * @return StdClass Config object
 */
function parseConfigData($configData) {
	preg_match_all('/([^\s:]+)[\s:]+(.+)/', $configData, $matches);

	$conf = new \StdClass();
	for ($i = 0; $i <= count($matches); ++$i) {
		$conf->{$matches[1][$i]} = trim($matches[2][$i]);
	}

	return $conf;
}

/**
 * Handle exceptions
 * @param Exception $e
 * @return
 */
function exceptionHandler(Exception $e) {
	// @header("Content-Type:text/plain");

	echo "<h1 style='font-size:24px'>Error</h1>\n",
	"<pre style='background:#f8f8f8;padding:8px'>\n",
	'<b>Caught ', basename(str_replace('\\', '/', get_class($e))),
	': "', $e->getMessage(), '"</b> (', $e->getFile(), ':', $e->getLine(), ")\n\n",
	'<span style="color:#811">', $e->getTraceAsString(), "</span>",
	"\n</pre>";

	exit;
}

set_exception_handler('exceptionHandler');

/**
 * Unique ID for session
 * @return string
 */
function uidSession() {
	$ip = $_SERVER["REMOTE_ADDR"];
	$browser = get_browser(null, true);

	return sha1(sha1('!#;' . $ip) . $browser['browser'] . $browser['platform']);
}
{'fraction_non_alphanumeric': 0.24948707427164546, 'fraction_numerical': 0.012310217480508822, 'mean_word_length': 4.804761904761905, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 31, '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': '2182024', 'n_tokens_mistral': 931, 'n_tokens_neox': 899, 'n_words': 173}