<commit_before><?php
    header('Content-type: application/json');
    include ('sc-app.inc');
    include(APP_WEB_DIR . '/inc/header.inc');

    use \com\indigloo\Util as Util;
    use \com\indigloo\sc\auth\Login as Login;
    use \com\indigloo\Logger as Logger ;

    set_exception_handler('webgloo_ajax_exception_handler');
    $message = NULL ;

    //use login is required for bookmarking
    /*
    if(!Login::hasSession()) {
        $message = array("code" => 401 , "message" => "Authentication failure: You need to login!");
        $html = json_encode($message);
        echo $html;
        exit;
    } */

    $target = $_POST["target"] ;
    $parser = new \com\indigloo\text\UrlParser();
    $response = $parser->extractUsingDom($target);
<commit_msg>Adding login check into extract image.<commit_after><?php
    header('Content-type: application/json');
    include ('sc-app.inc');
    include(APP_WEB_DIR . '/inc/header.inc');

    use \com\indigloo\Util as Util;
    use \com\indigloo\sc\auth\Login as Login;
    use \com\indigloo\Logger as Logger ;

    set_exception_handler('webgloo_ajax_exception_handler');
    $message = NULL ;

    //use login is required for image extraction
    
    if(!Login::hasSession()) {
        $message = array("code" => 401 , "message" => "Authentication failure: You need to login!");
        $html = json_encode($message);
        echo $html;
        exit;
    }

    $target = $_POST["target"] ;
    $parser = new \com\indigloo\text\UrlParser();
    $response = $parser->extractUsingDom($target);

{'fraction_non_alphanumeric': 0.15171078114912848, 'fraction_numerical': 0.003873466752743706, 'mean_word_length': 2.9845758354755785, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '2620753', 'n_tokens_mistral': 505, 'n_tokens_neox': 480, 'n_words': 108}