<commit_before><?php
include '../init.php';
include '../svg.php';

if (!is_logged_in()) {
    header("Location: ../login");
}


// Code does the same for each tab
if (isset($_GET['tab']) && $_GET['tab'] == 'unclassified') {
    $tab = "unclassified";
    $select = "SELECT `wm_raw_draw_data`.`id`, `data` as `image`, ".
              "`creation_date`, ".
              "COUNT(`wm_raw_data2formula`.`raw_data_id`) as `answers`,  ".
              "COUNT(`wm_worker_answers`.`raw_data_id`) as `answers2` ".
              "FROM `wm_raw_draw_data` ".
              "LEFT OUTER JOIN `wm_raw_data2formula` ".
                   "ON (`raw_data_id` = `wm_raw_draw_data`.`id`) ".
              "LEFT OUTER JOIN `wm_worker_answers`  ".
                   "ON (`wm_worker_answers`.`raw_data_id` = `wm_raw_draw_data`.`id`) ".
              "WHERE `accepted_formula_id` IS NULL AND `is_image`=0 ".
              "AND `nr_of_symbols` = 1 ".
              "GROUP BY `wm_raw_draw_data`.`id` ".
              "HAVING `answers` > 0 OR `answers2` > 0 ".
              "ORDER BY `creation_date` DESC ";

    // Get total number of elements for pagination
    $sql = "SELECT COUNT(*) as `counter` FROM ($select) AS T";
    $stmt = $pdo->prepare($sql);
    $stmt->execute();
    $row = $stmt->fetchObject();
    $total = $row->counter;

    // Get all raw data of this user
    $currentPage = isset($_GET['page']) ? intval($_GET['page']) : 1;
    $sql = $select." LIMIT ".(($currentPage-1)*14).", 14";
    $stmt = $pdo->prepare($sql);
    $stmt->execute();
    $userimages = $stmt->fetchAll();
} elseif (isset($_GET['tab']) && $_GET['tab'] == 'unclassified_multiple') {
    $tab = "unclassified_multiple";
    $select = "SELECT `wm_raw_draw_data`.`id`, `data` as `image`, ".
              "`creation_date`, ".
              "COUNT(`wm_raw_data2formula`.`raw_data_id`) as `answers`,  ".
              "COUNT(`wm_worker_answers`.`raw_data_id`) as `answers2` ".
              "FROM `wm_raw_draw_data` ".
              "LEFT OUTER JOIN `wm_raw_data2formula` ".
                   "ON (`raw_data_id` = `wm_raw_draw_data`.`id`) ".
              "LEFT OUTER JOIN `wm_worker_answers`  ".
                   "ON (`wm_worker_answers`.`raw_data_id` = `wm_raw_draw_data`.`id`) ".
              "WHERE `accepted_formula_id` IS NULL AND `is_image`=0 ".
              "AND `nr_of_symbols` > 1 ".
              "GROUP BY `wm_raw_draw_data`.`id` ".
              "HAVING `answers` > 0 OR `answers2` > 0 ".
              "ORDER BY `creation_date` DESC ";

    // Get total number of elements for pagination
    $sql = "SELECT COUNT(*) as `counter` FROM ($select) AS T";
    $stmt = $pdo->prepare($sql);
    $stmt->execute();
    $row = $stmt->fetchObject();
    $total = $row->counter;

    // Get all raw data of this user
    $currentPage = isset($_GET['page']) ? intval($_GET['page']) : 1;
    $sql = $select."LIMIT ".(($currentPage-1)*14).", 14";
    $stmt = $pdo->prepare($sql);
    $stmt->execute();
    $userimages = $stmt->fetchAll();
} elseif (isset($_GET['tab']) && $_GET['tab'] == 'unanswered') {
    $tab = "unanswered";
    $select = "SELECT `wm_raw_draw_data`.`id`, `data` as `image`, ".
              "`creation_date`, ".
              "COUNT(`wm_raw_data2formula`.`raw_data_id`) as `answers`,  ".
              "COUNT(`wm_worker_answers`.`raw_data_id`) as `answers2` ".
              "FROM `wm_raw_draw_data` ".
              "LEFT OUTER JOIN `wm_raw_data2formula`  ".
                   "ON (`wm_raw_data2formula`.`raw_data_id` = `wm_raw_draw_data`.`id`) ".
              "LEFT OUTER JOIN `wm_worker_answers`  ".
                   "ON (`wm_worker_answers`.`raw_data_id` = `wm_raw_draw_data`.`id`) ".
              "WHERE `accepted_formula_id` IS NULL AND `is_image`=0 ".
              "GROUP BY `wm_raw_draw_data`.`id` ".
              "HAVING `answers` = 0 AND `answers2` = 0 ".
              "ORDER BY `creation_date` DESC ".;

    // Get total number of elements for pagination
    $sql = "SELECT COUNT(*) as `counter` FROM ($select) AS T";
    $stmt = $pdo->prepare($sql);
    $stmt->execute();
    $row = $stmt->fetchObject();
    $total = $row->counter;

    // Get all raw data of this user
    $currentPage = isset($_GET['page']) ? intval($_GET['page']) : 1;
    $sql = $select." LIMIT ".(($currentPage-1)*14).", 14";
    $stmt = $pdo->prepare($sql);
    $stmt->execute();
    $userimages = $stmt->fetchAll();
} elseif (isset($_GET['tab']) && $_GET['tab'] == 'all') {
    $tab = "all";<commit_msg>gallery: minor syntax fix<commit_after><?php
include '../init.php';
include '../svg.php';

if (!is_logged_in()) {
    header("Location: ../login");
}


// Code does the same for each tab
if (isset($_GET['tab']) && $_GET['tab'] == 'unclassified') {
    $tab = "unclassified";
    $select = "SELECT `wm_raw_draw_data`.`id`, `data` as `image`, ".
              "`creation_date`, ".
              "COUNT(`wm_raw_data2formula`.`raw_data_id`) as `answers`,  ".
              "COUNT(`wm_worker_answers`.`raw_data_id`) as `answers2` ".
              "FROM `wm_raw_draw_data` ".
              "LEFT OUTER JOIN `wm_raw_data2formula` ".
                   "ON (`raw_data_id` = `wm_raw_draw_data`.`id`) ".
              "LEFT OUTER JOIN `wm_worker_answers`  ".
                   "ON (`wm_worker_answers`.`raw_data_id` = `wm_raw_draw_data`.`id`) ".
              "WHERE `accepted_formula_id` IS NULL AND `is_image`=0 ".
              "AND `nr_of_symbols` = 1 ".
              "GROUP BY `wm_raw_draw_data`.`id` ".
              "HAVING `answers` > 0 OR `answers2` > 0 ".
              "ORDER BY `creation_date` DESC ";

    // Get total number of elements for pagination
    $sql = "SELECT COUNT(*) as `counter` FROM ($select) AS T";
    $stmt = $pdo->prepare($sql);
    $stmt->execute();
    $row = $stmt->fetchObject();
    $total = $row->counter;

    // Get all raw data of this user
    $currentPage = isset($_GET['page']) ? intval($_GET['page']) : 1;
    $sql = $select." LIMIT ".(($currentPage-1)*14).", 14";
    $stmt = $pdo->prepare($sql);
    $stmt->execute();
    $userimages = $stmt->fetchAll();
} elseif (isset($_GET['tab']) && $_GET['tab'] == 'unclassified_multiple') {
    $tab = "unclassified_multiple";
    $select = "SELECT `wm_raw_draw_data`.`id`, `data` as `image`, ".
              "`creation_date`, ".
              "COUNT(`wm_raw_data2formula`.`raw_data_id`) as `answers`,  ".
              "COUNT(`wm_worker_answers`.`raw_data_id`) as `answers2` ".
              "FROM `wm_raw_draw_data` ".
              "LEFT OUTER JOIN `wm_raw_data2formula` ".
                   "ON (`raw_data_id` = `wm_raw_draw_data`.`id`) ".
              "LEFT OUTER JOIN `wm_worker_answers`  ".
                   "ON (`wm_worker_answers`.`raw_data_id` = `wm_raw_draw_data`.`id`) ".
              "WHERE `accepted_formula_id` IS NULL AND `is_image`=0 ".
              "AND `nr_of_symbols` > 1 ".
              "GROUP BY `wm_raw_draw_data`.`id` ".
              "HAVING `answers` > 0 OR `answers2` > 0 ".
              "ORDER BY `creation_date` DESC ";

    // Get total number of elements for pagination
    $sql = "SELECT COUNT(*) as `counter` FROM ($select) AS T";
    $stmt = $pdo->prepare($sql);
    $stmt->execute();
    $row = $stmt->fetchObject();
    $total = $row->counter;

    // Get all raw data of this user
    $currentPage = isset($_GET['page']) ? intval($_GET['page']) : 1;
    $sql = $select."LIMIT ".(($currentPage-1)*14).", 14";
    $stmt = $pdo->prepare($sql);
    $stmt->execute();
    $userimages = $stmt->fetchAll();
} elseif (isset($_GET['tab']) && $_GET['tab'] == 'unanswered') {
    $tab = "unanswered";
    $select = "SELECT `wm_raw_draw_data`.`id`, `data` as `image`, ".
              "`creation_date`, ".
              "COUNT(`wm_raw_data2formula`.`raw_data_id`) as `answers`,  ".
              "COUNT(`wm_worker_answers`.`raw_data_id`) as `answers2` ".
              "FROM `wm_raw_draw_data` ".
              "LEFT OUTER JOIN `wm_raw_data2formula`  ".
                   "ON (`wm_raw_data2formula`.`raw_data_id` = `wm_raw_draw_data`.`id`) ".
              "LEFT OUTER JOIN `wm_worker_answers`  ".
                   "ON (`wm_worker_answers`.`raw_data_id` = `wm_raw_draw_data`.`id`) ".
              "WHERE `accepted_formula_id` IS NULL AND `is_image`=0 ".
              "GROUP BY `wm_raw_draw_data`.`id` ".
              "HAVING `answers` = 0 AND `answers2` = 0 ".
              "ORDER BY `creation_date` DESC ";

    // Get total number of elements for pagination
    $sql = "SELECT COUNT(*) as `counter` FROM ($select) AS T";
    $stmt = $pdo->prepare($sql);
    $stmt->execute();
    $row = $stmt->fetchObject();
    $total = $row->counter;

    // Get all raw data of this user
    $currentPage = isset($_GET['page']) ? intval($_GET['page']) : 1;
    $sql = $select." LIMIT ".(($currentPage-1)*14).", 14";
    $stmt = $pdo->prepare($sql);
    $stmt->execute();
    $userimages = $stmt->fetchAll();
} elseif (isset($_GET['tab']) && $_GET['tab'] == 'all') {
    $tab = "all";
{'fraction_non_alphanumeric': 0.18807799442896936, 'fraction_numerical': 0.00935933147632312, 'mean_word_length': 2.4246470812666923, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 55, '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': '632335', 'n_tokens_mistral': 3223, 'n_tokens_neox': 3041, 'n_words': 644}