<commit_before><?php
// Set Logger Def
$defFile = '../misc/loggerdefs/' . $_POST['Definition'];
if(!file_exists($defFile)) {
	header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500);
	exit;
}
$LoggerDef = simplexml_load_file($defFile);

// Find our ECU IDs
$ecuArray = $LoggerDef->xpath('//ecuparam/ecu/@id');
array_walk($ecuArray, function(&$value, $key) {
	$value = (string) $value;
});

// Get sorted, unique IDs
$ecuArray = array_unique($ecuArray);
sort($ecuArray);

// 500 on empty array
// if(empty($ecuArray)) {
// 	header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500);
// 	exit;
// }

// Send it on back
echo json_encode($ecuArray);<commit_msg>try not throwing 500<commit_after><?php
// Set Logger Def
$defFile = '../misc/loggerdefs/' . $_POST['Definition'];
if(!file_exists($defFile)) {
	echo "Wrong File";
// 	header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500);
// 	exit;
}
$LoggerDef = simplexml_load_file($defFile);

// Find our ECU IDs
$ecuArray = $LoggerDef->xpath('//ecuparam/ecu/@id');
array_walk($ecuArray, function(&$value, $key) {
	$value = (string) $value;
});

// Get sorted, unique IDs
$ecuArray = array_unique($ecuArray);
sort($ecuArray);

// 500 on empty array
if(empty($ecuArray)) {
	echo "Empty Array";
// 	header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500);
// 	exit;
}

// Send it on back
echo json_encode($ecuArray);
{'fraction_non_alphanumeric': 0.19363762102351315, 'fraction_numerical': 0.022821576763485476, 'mean_word_length': 4.742063492063492, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3703600', 'n_tokens_mistral': 552, 'n_tokens_neox': 516, 'n_words': 120}