<commit_before><?php

###
# @name			Log Module
# @author		<NAME>
# @copyright	2014 by <NAME>
###

if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');

class Log extends Module {

	public static function error($database, $function, $line, $text = '') {

		# Check dependencies
		Module::dependencies(isset($database, $function, $line, $text));

		# Get time
		$sysstamp = time();

		# Escape
		$function	= mysqli_real_escape_string($database, $function);
		$line		= mysqli_real_escape_string($database, $line);
		$text		= mysqli_real_escape_string($database, $text);

		# Save in database
		$query	= "INSERT INTO lychee_log (time, type, function, line, text) VALUES ('$sysstamp', 'error', '$function', '$line', '$text');";
		$result	= $database->query($query);

		if (!$result) return false;
		return $database->insert_id;

	}

}

?><commit_msg>Added notice and warning function to Log (#143)<commit_after><?php

###
# @name			Log Module
# @author		<NAME>
# @copyright	2014 by <NAME>
###

if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');

class Log extends Module {

	public static function notice($database, $function, $line, $text = '') {

		return Log::text($database, 'notice', $function, $line, $text);

	}

	public static function warning($database, $function, $line, $text = '') {

		return Log::text($database, 'warning', $function, $line, $text);

	}

	public static function error($database, $function, $line, $text = '') {

		return Log::text($database, 'error', $function, $line, $text);

	}

	public static function text($database, $type, $function, $line, $text = '') {

		# Check dependencies
		Module::dependencies(isset($database, $type, $function, $line, $text));

		# Get time
		$sysstamp = time();

		# Escape
		$type		= mysqli_real_escape_string($type, $function);
		$function	= mysqli_real_escape_string($database, $function);
		$line		= mysqli_real_escape_string($database, $line);
		$text		= mysqli_real_escape_string($database, $text);

		# Save in database
		$query	= "INSERT INTO lychee_log (time, type, function, line, text) VALUES ('$sysstamp', '$type', '$function', '$line', '$text');";
		$result	= $database->query($query);

		if (!$result) return false;
		return true;

	}

}

?>
{'fraction_non_alphanumeric': 0.17785682525566918, 'fraction_numerical': 0.004891062694530902, 'mean_word_length': 5.016042780748663, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 12, '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': '3175491', 'n_tokens_mistral': 815, 'n_tokens_neox': 738, 'n_words': 201}