<commit_before><?php
/*
* PHP Quick Translate
* Author: <NAME> (https://micheldescoteaux.com)
* GitHub: https://github.com/MouseEatsCat/phpquicktranslate
*/

if(!function_exists('_t')){
	function _t($string){

		// Set the Default Language
		if(strpos($string, '[:') !== false){
			// Find the first instance of a language section in the string
			$defaultLang = substr($string, (strpos($string, '[:') + 2), (strpos($string, ']') - (strpos($string, '[:') + 2)));
		}else{
			// Language was not present in string
			return $string;
		}

		// Check to see if the "lang" GET parameter is set and is present in the string
		if(!empty($_GET['lang']) && strpos($string, '[:'. $_GET['lang'] .']') !== false){
			$defaultLang = $_GET['lang'];
		}
		// CHECKING THE STRING
		if(strpos($string, '[:'. $defaultLang .']') !== false){
			$tmpString = substr($string, (strpos($string, '[:'. $defaultLang .']') + strlen($defaultLang) + 3));
			if(strpos($tmpString, '[:') !== false){
				// Language was present in string and a following language section was found
				return substr($tmpString, 0, strpos($tmpString, '[:'));
			}else{
				// Language was present in string and no further languages in string
				return $tmpString;
			}
		}else{
			// Language was not present in string
			return $string;
		}
	}
}
/*
* ADDITIONAL FUNCTION
* Run the quick translate function and then echo the result
*/
if(!function_exists('_et')){
	function _et($string){
	  echo _t($string);
	}
}<commit_msg>minor optimizations<commit_after><?php
/**
PHP Quick Translate
Author: <NAME> (https://micheldescoteaux.com)
GitHub: https://github.com/MouseEatsCat/phpquicktranslate
*/

if(!function_exists('_t')){
	function _t($string){

		$numOfLanguages = substr_count($string, '[:');

		// Set the Default Language
		if($numOfLanguages > 0){
			// Find the first instance of a language section in the string
			$tagstart = strpos($string, '[:') + 2;
			$defaultLang = substr($string, $tagstart, strpos($string, ']') - $tagstart);
		}else{
			// Language was not present in string
			return $string;
		}

		// Check to see if the "lang" GET parameter is set and is present in the string
		if(!empty($_GET['lang']) && strpos($string, '[:'. $_GET['lang'] .']') !== false){
			$defaultLang = $_GET['lang'];
		}
		// CHECKING THE STRING
		if(strpos($string, '[:'. $defaultLang .']') !== false){
			$tmpString = substr($string, (strpos($string, '[:'. $defaultLang .']') + strlen($defaultLang) + 3));
			if(strpos($tmpString, '[:') !== false){
				// Language was present in string and a following language section was found
				return substr($tmpString, 0, strpos($tmpString, '[:'));
			}else{
				// Language was present in string and no further languages in string
				return $tmpString;
			}
		}else{
			// Language was not present in string
			return $string;
		}
	}
}
/**
ADDITIONAL FUNCTION
Run the quick translate function and then echo the result
*/
if(!function_exists('_et')){
	function _et($string){
	  echo _t($string);
	}
}
{'fraction_non_alphanumeric': 0.17790387182910547, 'fraction_numerical': 0.0026702269692923898, 'mean_word_length': 3.913114754098361, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 6, 'https://': 4, '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': '473904', 'n_tokens_mistral': 1061, 'n_tokens_neox': 948, 'n_words': 278}