<commit_before><?php
	namespace core;

	use core\modules\RouterModule;

	class RedirectError {

		/**
		 * @param integer $type
		 */
		public static function Redirect($type) {
			if ($type == 404) {
				header("HTTP/1.0 404 Not Found");
				header("location:".WEBROOT."404");
				die();
			}
		}


		/**
		 * test si la requete qui va chercher l'url de la page ++ les meta renvoi un resultat
		 * si elle ne renvoit pas de résultat, page does not  exist donc 404
		 * @param $query
		 * @param $url -> l'url a tester
		 * @return bool
		 */
		public static function testRedirect404($query, $url) {
			if (is_array($query)) {
				$count_query = count($query);
			}
			else {
				$count_query = 0;
			}

			$find = 'controller/';
			$controller = strpos($url, $find);

			if (($count_query > 0) || ((!is_array($query)) && ($query > 0)) || ($controller !== false)) {
				return true;
			}
			else {
				$router = new RouterModule();

				if ($router->getRouteModuleExist($url) !== true) {
					self::Redirect(404);
				}

				return false;
			}
		}
	}<commit_msg>update RedirectError class to simplify it<commit_after><?php
	namespace core;

	use core\modules\RouterModule;

	class RedirectError {

		/**
		 * @param integer $type
		 */
		public static function Redirect($type) {
			if ($type == 404) {
				header("HTTP/1.0 404 Not Found");
				header("location:".WEBROOT."404");
				die();
			}
		}


		/**
		 * test si la requete qui va chercher l'url de la page ++ les meta renvoi un resultat
		 * si elle ne renvoit pas de résultat, page does not  exist donc 404
		 * @param $query
		 * @param $url -> l'url a tester
		 * @return bool
		 */
		public static function testRedirect404($query, $url) {
			$count_query = 0;

			if (is_array($query)) {
				$count_query = count($query);
			}

			$find = 'controller/';
			$controller = strpos($url, $find);

			if (($count_query > 0) || ((!is_array($query)) && ($query > 0)) || ($controller !== false)) {
				return true;
			}
			else {
				$router = new RouterModule();

				if ($router->getRouteModuleExist($url) !== true) {
					self::Redirect(404);
				}

				return false;
			}
		}
	}
{'fraction_non_alphanumeric': 0.1592505854800937, 'fraction_numerical': 0.021545667447306793, 'mean_word_length': 2.7805309734513273, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '2857250', 'n_tokens_mistral': 914, 'n_tokens_neox': 705, 'n_words': 200}