<commit_before><?php
class Controller {
	protected $_default_site = null;

	public static function _access_type($type) {
		if(defined('HTML_ACCESS')) {
			if(HTML_ACCESS != ($type == 'html')) {
				throw new Exception("Trying to change HTML_ACCESS value.");
			}
			return;
		}
		if($type == 'html') {
			define('HTML_ACCESS', true);
		} else {
			define('HTML_ACCESS', false);
		}

		if($type == 'script') {
			$pos = stripos($_SERVER['HTTP_REFERER'], "://{$_SERVER['HTTP_HOST']}");
			if($pos != 4 && $pos != 5) {
				throw new Exception("Referer missmatch. Suspected CSRF attack. Referer is: {$_SERVER['HTTP_REFERER']} host is: {$_SERVER['HTTP_HOST']}");
			}
		}
	}

	public function __construct($site, $data = array()) {
		if(!$site) {
			$site = $this->_default_site;
			if(!$site) {
				throw new Exception("No default site to visit");
			}
		}
		if(substr($site, 0, 1) == '_') {
			throw new Exception("Trying to access disalowed site");
		}
		if(!method_exists($this, $site)) {
			throw new Exception("No such site: \"$site\"");
		}
		$this->$site($data);
	}
	
	private static function _reg($key) {
		static $data = array();
		$params = func_get_args();
		if(count($params) == 3) {
			return $data;
		}
		if(count($params) == 2) {
			$data[$key] = $params[1];
		} else {
			if(array_key_exists($key, $data)) {
				return $data[$key];
			} else {
				return false;
			}
		}
	}

	protected function _register($key, $value) {
		self::_reg($key, $value);
	}

	protected function _get($key) {
		return self::_reg($key);<commit_msg>Adding debug output.<commit_after><?php
class Controller {
	protected $_default_site = null;

	public static function _access_type($type) {
		if(defined('HTML_ACCESS')) {
			if(HTML_ACCESS != ($type == 'html')) {
				throw new Exception("Trying to change HTML_ACCESS value.");
			}
			return;
		}
		if($type == 'html') {
			define('HTML_ACCESS', true);
		} else {
			define('HTML_ACCESS', false);
		}

		if($type == 'script') {
			$pos = stripos($_SERVER['HTTP_REFERER'], "://{$_SERVER['HTTP_HOST']}");
			if($pos != 4 && $pos != 5) {
				throw new Exception("Referer missmatch. Suspected CSRF attack. Referer is: {$_SERVER['HTTP_REFERER']} host is: {$_SERVER['HTTP_HOST']}");
			}
		}
	}

	public function __construct($site, $data = array()) {
		if(!$site) {
			$site = $this->_default_site;
			if(!$site) {
				throw new Exception("No default site to visit");
			}
		}
		if(substr($site, 0, 1) == '_') {
			throw new Exception("Trying to access disalowed site");
		}
		if(!method_exists($this, $site)) {
			throw new Exception("No such site: \"".get_called_class()."/$site\"");
		}
		$this->$site($data);
	}
	
	private static function _reg($key) {
		static $data = array();
		$params = func_get_args();
		if(count($params) == 3) {
			return $data;
		}
		if(count($params) == 2) {
			$data[$key] = $params[1];
		} else {
			if(array_key_exists($key, $data)) {
				return $data[$key];
			} else {
				return false;
			}
		}
	}

	protected function _register($key, $value) {
		self::_reg($key, $value);
	}

	protected function _get($key) {
		return self::_reg($key);
{'fraction_non_alphanumeric': 0.19612903225806452, 'fraction_numerical': 0.004516129032258065, 'mean_word_length': 3.719939117199391, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 7, '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': '7020558', 'n_tokens_mistral': 1273, 'n_tokens_neox': 1104, 'n_words': 245}