<commit_before><?php
use \Tsugi\Util\LTI;
use \Tsugi\Core\LTIX;

require_once "top.php";
?>
<style>
    .card {
        border: 1px solid black;
        margin: 5px;
        padding: 5px;
        min-height: 8em;
    }
#loader {
      position: fixed;
      left: 0px;
      top: 0px;
      width: 100%;
      height: 100%;
      background-color: white;
      margin: 0;
      z-index: 100;
}
</style>
<?php
require_once "nav.php";
$anchor = isset($_GET['anchor']) ? $_GET['anchor'] : null;
$index = isset($_GET['index']) ? $_GET['index'] : null;
$waterfall = false;

if ( isset($_GET['lti_errormsg']) ) {
    $_SESSION['error'] = $_GET['lti_errormsg'];
}

echo('<div id="container">'."\n");

$OUTPUT->flashMessages();
if ( isset($_GET['detail']) ) {
    echo("\n<!--\n");
    echo(str_replace("-->","--:>",$_GET['detail']));
    echo("\n-->\n");
}

$json_str = file_get_contents('lessons.json');
$lessons = json_decode($json_str);

if ( $lessons === null ) {
    echo("<pre>\n");
    echo("Problem parsing lessons.json: ");
    echo(json_last_error_msg());
    echo("\n");
    echo($json_str);
    die();
}

if ( $anchor !== null || $index !== null ) {

    $count = 0;
    $module = false;
    $position = false;
    foreach($lessons->modules as $mod) {
	if ( isset($mod->login) && $mod->login && !isset($_SESSION['id']) ) continue;
        $count++;
        if ( $anchor !== null && isset($mod->anchor) && $anchor != $mod->anchor ) continue;
        if ( $index !== null && $index != $count ) continue;<commit_msg>Tweak<commit_after><?php
use \Tsugi\Util\LTI;
use \Tsugi\Core\LTIX;

require_once "top.php";
?>
<style>
    .card {
        border: 1px solid black;
        margin: 5px;
        padding: 5px;
        min-height: 8em;
    }
#loader {
      position: fixed;
      left: 0px;
      top: 0px;
      width: 100%;
      height: 100%;
      background-color: white;
      margin: 0;
      z-index: 100;
}
</style>
<?php
require_once "nav.php";
$anchor = isset($_GET['anchor']) ? $_GET['anchor'] : null;
$index = isset($_GET['index']) ? $_GET['index'] : null;
$waterfall = false;

if ( isset($_GET['lti_errormsg']) ) {
    $_SESSION['error'] = $_GET['lti_errormsg'];
}

echo('<div id="container">'."\n");

$OUTPUT->flashMessages();
if ( isset($_GET['detail']) ) {
    echo("\n<!--\n");
    echo(str_replace("-->","--:>",$_GET['detail']));
    echo("\n-->\n");
}

$json_str = file_get_contents('lessons.json');
$lessons = json_decode($json_str);

if ( $lessons === null ) {
    echo("<pre>\n");
    echo("Problem parsing lessons.json: ");
    echo(json_last_error_msg());
    echo("\n");
    echo($json_str);
    die();
}

// Filter modules based on login
if ( !isset($_SESSION['id']) ) {
    $filtered_modules = array();
    $filtered = false;
    foreach($lessons->modules as $module) {
	    if ( isset($module->login) && $module->login ) {
            $filtered = true;
            continue;
        }
        $filtered_modules[] = $module;
    }
    if ( $filtered ) $lessons->modules = $filtered_modules;
}

if ( $anchor !== null || $index !== null ) {

    $count = 0;
    $module = false;
    $position = false;
    foreach($lessons->modules as $mod) {
	if ( isset($mod->login) && $mod->login && !isset($_SESSION['id']) ) continue;
        $count++;
        if ( $anchor !== null && isset($mod->anchor) && $anchor != $mod->anchor ) continue;
        if ( $index !== null && $index != $count ) continue;
{'fraction_non_alphanumeric': 0.22088940901111762, 'fraction_numerical': 0.00994733762434172, 'mean_word_length': 2.9208715596330275, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 35, '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': '703452', 'n_tokens_mistral': 1239, 'n_tokens_neox': 1197, 'n_words': 245}