<commit_before><?php
if (!defined('BLARG')) die();

function loadRanksets()
{
	global $ranksetData, $ranksetNames;
	
	if(isset($ranksetNames)) return;
	
	$ranksetData = array();
	$ranksetNames = array();

	$dir = __DIR__."/../ranksets/";

	if (is_dir($dir))
	{
		if ($dh = opendir($dir))
		{
		    while (($file = readdir($dh)) !== false)
		    {
		        if(filetype($dir . $file) != "dir") continue;
		        if($file == ".." || $file == ".") continue;
		        $infofile = $dir.$file."/rankset.php";

		        if(file_exists($infofile))
		        	include($infofile);
		    }
		    closedir($dh);
		}
	}
}

function getRankHtml($rankset, $rank)
{
	$text = htmlspecialchars($rank["text"]);
	$img = '';
	if ($rank['image'])
	{
		$img = htmlspecialchars(resourceLink("ranksets/".$rankset."/".$rank["image"]));
		$img = "<img src=\"$img\" alt=\"\" /><br>";
	}
	return $img.$text;
}<commit_msg>Update ranksets.php<commit_after><?php

function loadRanksets()
{
	global $ranksetData, $ranksetNames;
	
	if(isset($ranksetNames)) return;
	
	$ranksetData = array();
	$ranksetNames = array();

	$dir = "ranksets/";

    if (is_dir($dir)) {
        if ($dh = opendir($dir)) {
            while (($file = readdir($dh)) !== false) {
                if(filetype($dir . $file) != "dir") continue;
                if($file == ".." || $file == ".") continue;
                $jsonfile = $dir.$file."/rankset.json";
                if(file_exists($jsonfile)) {
                    switch (json_last_error()) {
                    case JSON_ERROR_NONE:
                        break;
                    case JSON_ERROR_DEPTH:
                        echo ' - Maximum stack depth exceeded';
                        break;
                    case JSON_ERROR_STATE_MISMATCH:
                        echo ' - Underflow or the modes mismatch';
                        break;
                    case JSON_ERROR_CTRL_CHAR:
                        echo ' - Unexpected control character found';
                        break;
                    case JSON_ERROR_SYNTAX:
                        echo ' - Syntax error, malformed JSON';
                        break;
                    case JSON_ERROR_UTF8:
                        echo ' - Malformed UTF-8 characters, possibly incorrectly encoded';
                        break;
                    default:
                        echo ' - Unknown JSON error';
                        break;
                    }
                    $ranksetNames[$file] = $file;
                    $ranksetData[$file] = array();
                    $data = json_decode(file_get_contents($jsonfile, FILE_USE_INCLUDE_PATH), true);
                    foreach($data as $text => $d) {
                        $num = $d["num"];
                        $image = $d["image"];
                        array_push($ranksetData[$file],array("num" => $num, "image" => $image, "text" => $text));
                    }
                }
                else if(file_exists($dir.$file."/rankset.php"))
                    include($dir.$file."/rankset.php");
            }
            closedir($dh);
        }
    }
}

function getRankHtml($rankset, $rank)
{
	$text = htmlspecialchars($rank["text"]);
	$img = '';
	if ($rank['image'])
	{
		$img = htmlspecialchars(resourceLink("ranksets/".$rankset."/".$rank["image"]));
		$img = "<img src=\"$img\" alt=\"\" /><br>";
	}
	return $img.$text;
}
{'fraction_non_alphanumeric': 0.1636685343556473, 'fraction_numerical': 0.0005897965202005308, 'mean_word_length': 1.5972434915773355, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '5127243', 'n_tokens_mistral': 1059, 'n_tokens_neox': 997, 'n_words': 186}