<commit_before><?php

	include('db.php');
	
	function getPageURL() {
		$pageURL = $_SERVER["REQUEST_URI"];
		$url = str_replace("/lexlauncher/api/", "", $pageURL);
		return $url;
	}
	
	//functions list
	$whitelist = array(
		'pack'
	);
	
	//call the passed in function_exists
	$method = explode("/", getPageURL());
	$command = $method[0];
	$arguments = $method;
	
	if(in_array($command, $whitelist)) {
		$method[0]($arguments);
	} else {
		error404();
	}
	
	//methods
	function getResponce($error, $code, $message, $array) {
		if($error == null) {
			if($array == null) {
				$error = true;
			} else {
				$error = false;
			}
		}
		$responce = array(
			"error" => $error,
			"code" => $code,
			"message" => $message,
			"data" => $array
		);
		return $responce;
	}
	function error404() {
		$responce = json_encode(getResponce(true, 404, "API Call Path Not Found", null));
		echo $responce;
	}
	function pack($arguments) {
		if(count($arguments) == 0 || count($arguments) == 1) {
			error404();
		} else {
			if(count($arguments) == 2) {
				
				echo 'this isnt done yet!';
					
			} elseif(count($arguments) == 3) {
				
				echo 'this isnt done yet';
					
			} else {
				error404();
			}
		}
	}
?><commit_msg>Added API versioning, needs improving but the core concept is there.<commit_after><?php
	include('db.php');
	
	function getPageURL() {
		$pageURL = $_SERVER["REQUEST_URI"];
		$url = str_replace("/lexlauncher/newapi/", "", $pageURL);
		return $url;
	}
	
	//functions list
	$whitelist = array(
		'pack'
	);
	$api_versions = array(
		'v1'
	);
	
	//call the passed in function_exists
	$method = explode("/", getPageURL());
	$api_version = $method[0];
	if(!$method[1] == null) {
		$command = $method[1];
	} else {
		$command = null;
	}
	$arguments = $method;
	
	if(in_array($command, $whitelist)) {
		if(!$method[0] == "pack") {
			getPack($arguments);
		} else {
			$method[0]($arguments);
		}
	} else {
		error($api_version, $api_versions);
	}
	
	//methods
	function getResponce($error, $code, $message, $array) {
		if($error == null) {
			if($array == null) {
				$error = true;
			} else {
				$error = false;
			}
		}
		$responce = array(
			"error" => $error,
			"code" => $code,
			"message" => $message,
			"data" => $array
		);
		return $responce;
	}
	function error($api_version, $api_versions) {
		$message = "API Call Path Not Found";
		$code = 404;
		if(!in_array($api_version, $api_versions)) {
			$message = "API Version Not Specified";
			$code = 402;
		}
		$responce = json_encode(getResponce(true, $code, $message, null));
		echo $responce;
	}
	function getPack($arguments) {
		if(count($arguments) == 1 || count($arguments) == 2) {
			error($api_version, $api_versions);
		} else {
			if(count($arguments) == 3) {
				
				echo 'this isnt done yet!';
					
			} elseif(count($arguments) == 4) {
				
				echo 'this isnt done yet';
					
			} else {
				error($api_version, $api_versions);
			}
		}
	}
?>
{'fraction_non_alphanumeric': 0.1887563884156729, 'fraction_numerical': 0.012606473594548553, 'mean_word_length': 3.200286123032904, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '6284833', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1079, 'n_words': 235}