<commit_before><?php
define('APP_TIME_START', microtime(true));

include_once(dirname(__FILE__) . '/functions.php');

$AUTOLOAD_PATH =  array(
	dirname(__FILE__) . '/framework',
	APP_PATH . '/models',
	APP_PATH . '/classes',
);

function __autoload($class_name){
	global $AUTOLOAD_PATH;
	foreach($AUTOLOAD_PATH as $dir){
		$file = $dir . '/' . $class_name . '.php';
		if(file_exists($file)){
			require_once($file);
		}
	}
}

function include_paths(){
	static $paths = array();
	if(!$paths){
		$path = base_path();
		if(strlen($path) == 0){
			$ps = array('index');
		}else{
			$ps = explode('/', $path);
		}
		$act = $ps[count($ps) - 1];
		if($act == 'new'){
			$act = 'create';
		}
		$paths[] = array(
			'base' => join('/', array_slice($ps, 0, -1)),
			'action' => $act,
		);
		$paths[] = array(
			'base' => join('/', $ps),
			'action' => 'index',
		);
		if($act != 'index'){
			$paths[] = array(
				'base' => join('/', $ps) . '/index',
				'action' => 'index',
			);
			$paths[] = array(
				'base' => join('/', array_slice($ps, 0, -1)) . '/index',
				'action' => $act,
			);
		}
	}
	return $paths;
}

function load_controller($base, $action){
	$dir = APP_PATH . '/controllers/' . $base;
	$file = $dir . '.php';
	#echo join(', ', array($base, $action, $file)) . "\n";
	if(file_exists($file)){
		include($file);
		$ps = explode('/', $base);
		$controller = ucfirst($ps[count($ps) - 1]);
		$cls = "{$controller}Controller";
		$ins = new $cls();
		
		$found = false;
		if(method_exists($ins, $action)){<commit_msg>report class not found instead of fatal error<commit_after><?php
define('APP_TIME_START', microtime(true));

include_once(dirname(__FILE__) . '/functions.php');

$AUTOLOAD_PATH =  array(
	dirname(__FILE__) . '/framework',
	APP_PATH . '/models',
	APP_PATH . '/classes',
);

function __autoload($cls){
	global $AUTOLOAD_PATH;
	foreach($AUTOLOAD_PATH as $dir){
		$file = $dir . '/' . $cls . '.php';
		if(file_exists($file)){
			require_once($file);
			break;
		}
	}
	if(!class_exists($cls)){
		throw new Exception("Class $cls not found!");
	}
}

function include_paths(){
	static $paths = array();
	if(!$paths){
		$path = base_path();
		if(strlen($path) == 0){
			$ps = array('index');
		}else{
			$ps = explode('/', $path);
		}
		$act = $ps[count($ps) - 1];
		if($act == 'new'){
			$act = 'create';
		}
		$paths[] = array(
			'base' => join('/', array_slice($ps, 0, -1)),
			'action' => $act,
		);
		$paths[] = array(
			'base' => join('/', $ps),
			'action' => 'index',
		);
		if($act != 'index'){
			$paths[] = array(
				'base' => join('/', $ps) . '/index',
				'action' => 'index',
			);
			$paths[] = array(
				'base' => join('/', array_slice($ps, 0, -1)) . '/index',
				'action' => $act,
			);
		}
	}
	return $paths;
}

function load_controller($base, $action){
	$dir = APP_PATH . '/controllers/' . $base;
	$file = $dir . '.php';
	#echo join(', ', array($base, $action, $file)) . "\n";
	if(file_exists($file)){
		include($file);
		$ps = explode('/', $base);
		$controller = ucfirst($ps[count($ps) - 1]);
		$cls = "{$controller}Controller";
		if(!class_exists($cls)){
			throw new Exception("Controller $cls not found!");
		}
		$ins = new $cls();
		
		$found = false;
		if(method_exists($ins, $action)){
{'fraction_non_alphanumeric': 0.24891506509609423, 'fraction_numerical': 0.0043397396156230625, 'mean_word_length': 3.538677918424754, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '7501090', 'n_tokens_mistral': 1375, 'n_tokens_neox': 1245, 'n_words': 261}