<commit_before><?php

function analyse_db() {
	global $config;
	
	$result = array(
		'name' => 'Database check',
		'alarm' => 'green',
		'data' => '',
		'detail' => NULL,
	);
	
	$damaged = 0;
	$memtables = 0;
	$db_check_level = read_config_option('intropage_analyse_db_level');
	
	$tables = db_fetch_assoc ("SHOW TABLES");
	foreach($tables as $key=>$val) {

		$row = db_fetch_row("check table ".current($val)." $db_check_level");
		if (preg_match('/^note$/i',$row["Msg_type"]) && preg_match('/doesn\'t support/i',$row["Msg_text"])) { $memtables++; }
		elseif (!preg_match('/OK/i',$row["Msg_text"])) { $damaged++; $result['detail'] .= "Table " . $row["Table"] . " status " . $row["Msg_text"] . "<br/>\n"; }
	}
	
	if ($damaged > 0) { 
	    $result['alarm'] = "red";
	    $result['data'] = "<span class=\"txt_big\">DB problem</span><br/><br/>"; 
	}
	else	{
	    $result['data'] = "<span class=\"txt_big\">DB OK</span><br/><br/>"; 
	}	

// connecton errors
	$cerrors = 0;
	$con_err = db_fetch_assoc ("SHOW GLOBAL STATUS LIKE '%Connection_errors%'");

	foreach($con_err as $key=>$val) {
	    $cerrors = $cerrors + $val['Value'];
	}

	if ($cerrors > 0 && $result['alarm'] == "green")	// only yellow
		$result['alarm'] = "yellow";


        $result['data'] .= "Connection errors: $cerrors<br/>";

	
	$result['data'] .= "Damaged tables: $damaged<br/>Memory tables: $memtables<br/>All tables: " . count($tables);
	
	return $result;
}

?>
<commit_msg>fix empty value and typo<commit_after><?php

function analyse_db() {
	global $config;
	
	$result = array(
		'name' => 'Database check',
		'alarm' => 'green',
		'data' => '',
		'detail' => '',
	);
	
	$damaged = 0;
	$memtables = 0;
	$db_check_level = read_config_option('intropage_analyse_db_level');
	
	$tables = db_fetch_assoc ("SHOW TABLES");
	foreach($tables as $key=>$val) {

		$row = db_fetch_row("check table ".current($val)." $db_check_level");
		if (preg_match('/^note$/i',$row["Msg_type"]) && preg_match('/doesn\'t support/i',$row["Msg_text"])) { $memtables++; }
		elseif (!preg_match('/OK/i',$row["Msg_text"])) { $damaged++; $result['detail'] .= "Table " . $row["Table"] . " status " . $row["Msg_text"] . "<br/>\n"; }
	}
	
	if ($damaged > 0) { 
	    $result['alarm'] = "red";
	    $result['data'] = "<span class=\"txt_big\">DB problem</span><br/><br/>"; 
	}
	else	{
	    $result['data'] = "<span class=\"txt_big\">DB OK</span><br/><br/>"; 
	}	

// connection errors
	$cerrors = 0;
	$con_err = db_fetch_assoc ("SHOW GLOBAL STATUS LIKE '%Connection_errors%'");

	foreach($con_err as $key=>$val) {
	    $cerrors = $cerrors + $val['Value'];
	}

	if ($cerrors > 0 && $result['alarm'] == "green")	// only yellow
		$result['alarm'] = "yellow";


        $result['data'] .= "Connection errors: $cerrors<br/>";

	
	$result['data'] .= "Damaged tables: $damaged<br/>Memory tables: $memtables<br/>All tables: " . count($tables);
	
	return $result;
}

?>

{'fraction_non_alphanumeric': 0.23761031907671418, 'fraction_numerical': 0.0033944331296673455, 'mean_word_length': 3.7609046849757672, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 45, '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': '4477938', 'n_tokens_mistral': 1192, 'n_tokens_neox': 1115, 'n_words': 205}