<commit_before><?php
App::uses('AppHelper', 'View/Helper');

// This helper accepts a string to be processed and an single or an array of strings that get turned into regex search patterns.
// It will then run each of those through the string with preg_replaces, highlighting all the matched terms in red
// Used for things such as searches in the logs to highlight found terms

	class HighlightHelper extends AppHelper {

		/**
		 * Important: data needs to be sanitized using the h() function before entering this function
		 * @param unknown_type $keywordArray
		 */
		public function build_replace_pairs($keywordArray) {
			// build the $replacePairs variable used to highlight the keywords
			$replacementArray = array();
			if (!is_array($keywordArray)) {
				$keywordArray = array($keywordArray);
			}
			foreach ($keywordArray as $k => &$keywordArrayElement) {
			    $keywordArrayElement = trim($keywordArrayElement);
			    if ("" == $keywordArrayElement) {
			    	unset($keywordArray[$k]);
			    	continue;
			    }
			    $replacementArray[] = '<span style="color:red">'.$keywordArrayElement.'</span>';
			}
			if (!empty($replacementArray))
				debug ($keywordArray);
			debug($replacementArray);
			    return array_combine($keywordArray, $replacementArray);
		}

		public function highlighter($str, $replacePairs) {
			if (is_array($replacePairs)) {
				return strtr($str, $replacePairs);
			} else {
				return $str;
			}

		}
	}
?><commit_msg>Accidental inclusion of some debug in the previous commit<commit_after><?php
App::uses('AppHelper', 'View/Helper');

// This helper accepts a string to be processed and an single or an array of strings that get turned into regex search patterns.
// It will then run each of those through the string with preg_replaces, highlighting all the matched terms in red
// Used for things such as searches in the logs to highlight found terms

	class HighlightHelper extends AppHelper {

		/**
		 * Important: data needs to be sanitized using the h() function before entering this function
		 * @param unknown_type $keywordArray
		 */
		public function build_replace_pairs($keywordArray) {
			// build the $replacePairs variable used to highlight the keywords
			$replacementArray = array();
			if (!is_array($keywordArray)) {
				$keywordArray = array($keywordArray);
			}
			foreach ($keywordArray as $k => &$keywordArrayElement) {
			    $keywordArrayElement = trim($keywordArrayElement);
			    if ("" == $keywordArrayElement) {
			    	unset($keywordArray[$k]);
			    	continue;
			    }
			    $replacementArray[] = '<span style="color:red">'.$keywordArrayElement.'</span>';
			}
			if (!empty($replacementArray))
			    return array_combine($keywordArray, $replacementArray);
		}

		public function highlighter($str, $replacePairs) {
			if (is_array($replacePairs)) {
				return strtr($str, $replacePairs);
			} else {
				return $str;
			}

		}
	}
?>
{'fraction_non_alphanumeric': 0.11057692307692307, 'fraction_numerical': 0.0, 'mean_word_length': 3.814876033057851, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '2213508', 'n_tokens_mistral': 928, 'n_tokens_neox': 784, 'n_words': 267}