<commit_before><?php

namespace App;

use Monolog\ErrorHandler;

class GracefulErrorHandler extends ErrorHandler {
	/**
	 * @param \Exception $e
	 */
	private function _outputErrorPage($e){
		File::put(PROJPATH.'logs/'.((string) microtime(true)).'-error.log', var_export($e->getTraceAsString(), true));

		if (headers_sent())
			return;

		$title = '500 Internal Server Error';
		header($_SERVER['SERVER_PROTOCOL']." $title");
		echo <<<HTML<commit_msg>Add actual error message to exported traces<commit_after><?php

namespace App;

use Monolog\ErrorHandler;

class GracefulErrorHandler extends ErrorHandler {
	/**
	 * @param \Exception $e
	 */
	private function _outputErrorPage($e){
		File::put(PROJPATH.'logs/'.date('c').'-error.log', $e->getMessage()."\n".$e->getTraceAsString());

		if (headers_sent())
			return;

		$title = '500 Internal Server Error';
		header($_SERVER['SERVER_PROTOCOL']." $title");
		echo <<<HTML
{'fraction_non_alphanumeric': 0.1722643553629469, 'fraction_numerical': 0.0065005417118093175, 'mean_word_length': 5.119205298013245, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 6, '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': '2984697', 'n_tokens_mistral': 318, 'n_tokens_neox': 293, 'n_words': 65}