<commit_before><?php
	/**
	 * @package content
	 */
	/**
	 * The AjaxTranslate page is used for translating strings on the fly
	 * that are used in Symphony's javascript
	 */
	Class contentAjaxTranslate extends AjaxPage{

		public function handleFailedAuthorisation(){
			$this->_status = self::STATUS_UNAUTHORISED;
			$this->_Result = json_encode(array('status' => __('You are not authorised to access this page.')));
		}

		public function view(){
			$strings = $_GET['strings'];
			$namespace = (empty($_GET['namespace']) ? null : $_GET['namespace']);

			$new = array();
			foreach($strings as $key => $value) {
			
				// Check value
				$value = urldecode($value);
				if(empty($value)) {
					$value = urldecode($key);
				}
				
				// Translate
				$new[$value] = Lang::translate($value, null, $namespace);
			}
			$this->_Result = json_encode($new);
		}

		public function generate(){
			header('Content-Type: application/json');
			echo $this->_Result;
			exit;<commit_msg>Check if values are set or not<commit_after><?php
	/**
	 * @package content
	 */
	/**
	 * The AjaxTranslate page is used for translating strings on the fly
	 * that are used in Symphony's javascript
	 */
	Class contentAjaxTranslate extends AjaxPage{

		public function handleFailedAuthorisation(){
			$this->_status = self::STATUS_UNAUTHORISED;
			$this->_Result = json_encode(array('status' => __('You are not authorised to access this page.')));
		}

		public function view(){
			$strings = $_GET['strings'];
			$namespace = (empty($_GET['namespace']) ? null : $_GET['namespace']);

			$new = array();
			foreach($strings as $key => $value) {
			
				// Check value
				if(empty($value) || $value = 'false') {
					$value = $key;
				}
				
				// Translate
				$new[$value] = Lang::translate(urldecode($value), null, $namespace);
			}
			$this->_Result = json_encode($new);
		}

		public function generate(){
			header('Content-Type: application/json');
			echo $this->_Result;
			exit;
{'fraction_non_alphanumeric': 0.15813482007095794, 'fraction_numerical': 0.0, 'mean_word_length': 3.5275229357798166, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '7547058', 'n_tokens_mistral': 724, 'n_tokens_neox': 585, 'n_words': 157}