<commit_before><?php

include_once GNAT_ROOT.'/lib/core_blog.php';

class urlHandler{

	private $url;
	private $controller;
	private $controllerId;


	public function __construct(){

		$this->url = $_GET['url'];
		$this->parseUrl();
		$this->selectController();


	}

	private function parseUrl(){

		$requestUri = explode( '/', $this->url );
		#unset( $requestUri[0] );
		#print_r( $requestUri );

		$_GET['id'] = '';
		$_GET['controller'] = 'page';

		$requestUri = array_values( $requestUri );


	    if ( count( $requestUri ) >= 1 )
            $_GET['controller'] = array_shift( $requestUri );

        if ( count( $requestUri ) >= 2 )

	        $_GET['id'] = array_shift( $requestUri );

	    if ( count( $requestUri ) > 2 ){

	        $sessionMvc = new session( array( 'controller' ) );

	        for( $i = 0; $i < count( $requestUri ); $i+=2 ){
	                $value = "";
	                $key = $requestUri[$i];
	                if ( $i+1 < count( $requestUri ) ){
                        $j = $i + 1;
                        $value = $requestUri[$j];
	 
	                }

	                $_GET[$key] = $value;
	        }

	        $this->controllerId = $sessionMvc->controller;
		}

	}

	private function selectController(){

		$this->controller = "controller/control_".$this->controllerId.".php";

		if ( ! file_exists($this->controller) ){
			$this->controller = "controller/control_error.php";
			$this->controllerId = "Error404";<commit_msg>fix dumb issue with shifting array and emtpy options<commit_after><?php

include_once GNAT_ROOT.'/lib/core_blog.php';

class urlHandler{

	private $url;
	private $controller;
	private $controllerId;


	public function __construct(){

		$this->url = $_GET['url'];
		$this->parseUrl();
		$this->selectController();


	}

	private function parseUrl(){

		$requestUri = explode( '/', $this->url );
		#unset( $requestUri[0] );
		#print_r( $requestUri );

		$_GET['id'] = '';
		$_GET['controller'] = 'page';

		$requestUri = array_values( $requestUri );

		$arraySize = count( $requestUri );


	    if ( $arraySize ) >= 1 )

			if ( $requestUri[0] != '' )
            	$_GET['controller'] = array_shift( $requestUri );

        if ( $arraySize >= 2 )
        	if ( $requestUri[0] != '' )
	        	$_GET['id'] = array_shift( $requestUri );

	    if ( $arraySize > 2 ){

	        $sessionMvc = new session( array( 'controller' ) );

	        for( $i = 0; $i < count( $requestUri ); $i+=2 ){
	                $value = "";
	                $key = $requestUri[$i];
	                if ( $i+1 < count( $requestUri ) ){
                        $j = $i + 1;
                        $value = $requestUri[$j];
	 
	                }

	                $_GET[$key] = $value;
	        }

	        $this->controllerId = $sessionMvc->controller;
		}

	}

	private function selectController(){

		$this->controller = "controller/control_".$this->controllerId.".php";

		if ( ! file_exists($this->controller) ){
			$this->controller = "controller/control_error.php";
			$this->controllerId = "Error404";
{'fraction_non_alphanumeric': 0.1752712923380467, 'fraction_numerical': 0.007892140743176587, 'mean_word_length': 2.292207792207792, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 31, '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': '2997017', 'n_tokens_mistral': 1072, 'n_tokens_neox': 939, 'n_words': 193}