<commit_before><?php

use \Tsugi\Util\U;
use \Tsugi\Core\LTIX;
use \Tsugi\Core\Annotate;

require_once "../../config.php";
require_once "annotate_util.php";

$pieces = U::rest_path();
if ( ! isset($pieces->controller) || strlen($pieces->controller) < 1 ) {
    http_response_code(500);
    echo("<pre>\nMissing Session\n\n");
    echo(htmlentities(print_r($pieces, TRUE)));
    die();
}

$sessparts = explode(':',$pieces->controller);
if ( count($sessparts) != 2 ) {
    http_response_code(500);
    echo("<pre>\nMissing user_id\n\n");
    echo(htmlentities(print_r($pieces, TRUE)));
    die();
}

$sess_id = $sessparts[0];
$user_id = $sessparts[1];

// Force the session ID REST style :)
$_GET[session_name()] = $sess_id;
$LAUNCH = LTIX::requireData();


if ( $_SERVER['REQUEST_METHOD'] === 'GET' ) {
    $annotations = loadAnnotations($LAUNCH, $user_id);
    error_log('GET'. count($annotations));
    header('Content-Type: application/json; charset=utf-8');<commit_msg>Updates<commit_after><?php

use \Tsugi\Util\U;
use \Tsugi\Core\LTIX;
use \Tsugi\Core\Annotate;

require_once "../../config.php";
require_once "annotate_util.php";

$pieces = U::rest_path();
if ( ! isset($pieces->controller) || strlen($pieces->controller) < 1 ) {
    http_response_code(500);
    echo("<pre>\nMissing Session\n\n");
    echo(htmlentities(print_r($pieces, TRUE)));
    die();
}

$sessparts = explode(':',$pieces->controller);
if ( count($sessparts) != 2 ) {
    http_response_code(500);
    echo("<pre>\nMissing user_id\n\n");
    echo(htmlentities(print_r($pieces, TRUE)));
    die();
}

$sess_id = $sessparts[0];
$user_id = $sessparts[1];

// Force the session ID REST style :)
$_GET[session_name()] = $sess_id;
$LAUNCH = LTIX::requireData();


if ( $_SERVER['REQUEST_METHOD'] === 'GET' ) {
    $annotations = loadAnnotations($LAUNCH, $user_id);
    header('Content-Type: application/json; charset=utf-8');
{'fraction_non_alphanumeric': 0.20527704485488127, 'fraction_numerical': 0.011609498680738786, 'mean_word_length': 4.780487804878049, 'pattern_counts': {'":': 0, '<': 11, '<?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': '6013653', 'n_tokens_mistral': 732, 'n_tokens_neox': 703, 'n_words': 115}