<commit_before><?php

    $s_time = microtime(true);
    include 'sc-app.inc';
    include(APP_WEB_DIR . '/inc/header.inc');

    use \com\indigloo\Configuration as Config ;
    use \com\indigloo\Logger  as Logger ;
    use \com\indigloo\Util  as Util ;


    $router = new com\indigloo\sc\router\Router();
    $originalURI = $_SERVER['REQUEST_URI'];
    $requestURI = $originalURI ;

    //initialize routing table
    $router->initTable();
    $pos = strpos($originalURI, '?');
    $qpart = NULL ;

    if($pos !== false) {
        //remove the part after ? from Url
        // routing does not depends on query parameters
        $requestURI = substr($originalURI,0,$pos);
        $qpart = substr($originalURI, $pos+1);
    }

    $route = $router->getRoute($requestURI);

    if(is_null($route)) {
        //No valid route for this path
        $message = sprintf("No route for path %s",$requestURI);
        Logger::getInstance()->error($message);

        $controller = new \com\indigloo\sc\controller\Http404();
        $controller->process();
        exit;

    } else {
        $controllerName = $route["action"];
        //add query part
        if(!is_null($qpart)){
            $route["params"]["q"] = $qpart ;
        }

        if(Config::getInstance()->is_debug()) {
            $message = sprintf("controller %s :: path is %s  ", $controllerName, $requestURI);
            Logger::getInstance()->debug($message);
            Logger::getInstance()->dump($route);
        }

        $controller = new $controllerName();
        $controller->process($route["params"], $route["options"]);

    }

    $e_time = microtime(true);
    printf("Request %s took %f milliseconds \n", $originalURI, ($e_time - $s_time)*1000);

?><commit_msg>pass path and query as options to controller<commit_after><?php

    $s_time = microtime(true);
    include 'sc-app.inc';
    include(APP_WEB_DIR . '/inc/header.inc');

    use \com\indigloo\Configuration as Config ;
    use \com\indigloo\Logger  as Logger ;
    use \com\indigloo\Util  as Util ;


    $router = new com\indigloo\sc\router\Router();
    $originalURI = $_SERVER['REQUEST_URI'];
    $requestURI = $originalURI ;

    //initialize routing table
    $router->initTable();
    $pos = strpos($originalURI, '?');
    $qpart = NULL ;

    if($pos !== false) {
        //remove the part after ? from Url
        // routing does not depends on query parameters
        $requestURI = substr($originalURI,0,$pos);
        $qpart = substr($originalURI, $pos+1);
    }

    $route = $router->getRoute($requestURI);

    if(is_null($route)) {
        //No valid route for this path
        $message = sprintf("No route for path %s",$requestURI);
        Logger::getInstance()->error($message);

        $controller = new \com\indigloo\sc\controller\Http404();
        $controller->process();
        exit;

    } else {
        $controllerName = $route["action"];
        //add path and query 
        $options = array();
        $options["path"] = $requestURI ;
        $options["query"] = $qpart;
        $route["options"] = $options ;

        if(Config::getInstance()->is_debug()) {
            $message = sprintf("controller %s :: path is %s  ", $controllerName, $requestURI);
            Logger::getInstance()->debug($message);
            Logger::getInstance()->dump($route);
        }

        $controller = new $controllerName();
        $controller->process($route["params"], $route["options"]);

    }

    $e_time = microtime(true);
    printf("Request %s took %f milliseconds \n", $originalURI, ($e_time - $s_time)*1000);

?>
{'fraction_non_alphanumeric': 0.16429567642956763, 'fraction_numerical': 0.00502092050209205, 'mean_word_length': 2.593186372745491, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '5580367', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1056, 'n_words': 235}