<commit_before><?php 
$con = mysql_connect("localhost", "ngembryo", "ngembryo");
if (!$con) {
    die('Could not connect: '.mysql_error());
}

mysql_select_db("ngembryo", $con);

$table = "2DmarkerResource";
if ($_GET[type] == "2dregion") {
    $table = "2DregionResource";
} else {
    if ($_GET[type] == "3dmarker") {
        $table = "3DmarkerResource";
    }
}

$result = mysql_query("SELECT * FROM $table WHERE aid=$_GET[id]");

if ($_GET[format] == "json") {
    echo '[';
    if ($resource = mysql_fetch_array($result)) {
        $rid = $resource['rid'];
        $temp = mysql_query("SELECT * FROM resource WHERE id = '$rid'");
        $detail = mysql_fetch_array($temp);
        echo '{ id: '.$detail['id'].', title: "'.$detail['title'].'", summary: "'.$detail['abstract'].'", url: "'.$detail['url'].'"}';
    }
    while ($resource = mysql_fetch_array($result)) {
        $rid = $resource['rid'];
        $temp = mysql_query("SELECT * FROM resource WHERE id = '$rid'");
        $detail = mysql_fetch_array($temp);
        echo ', { id: '.$detail['id'].', title: "'.$detail['title'].'", summary: "'.$detail['abstract'].'", url: "'.$detail['url'].'"}';
    }
    echo ']';
} else {
    if ($_GET[format] == "csv") {
    	print('id,'.'title,'.'abstract,'.'url'."\n");
        while ($resource = mysql_fetch_array($result)) {
            $rid = $resource['id'];
            $temp = mysql_query("SELECT * FROM resource WHERE id = '$rid'");
            $detail = mysql_fetch_array($temp);
            print($detail['id'].',"'.$detail['title'].'","'.$detail['abstract'].'","'.$detail['url'].'"'."\n");
        }    	
    } else {
        echo '<resourcelist>';
        while ($resource = mysql_fetch_array($result)) {
            $rid = $resource['id'];
            $temp = mysql_query("SELECT * FROM resource WHERE id = '$rid'");
            $detail = mysql_fetch_array($temp);
            echo '<resource><id>'.$detail['id'].'</id><title>'.$detail['title'].'</title><abstract>'.$detail['abstract'].'</abstract><url>'.$detail['url'].'</url></resource>';
        }
        echo '</resourcelist>';
    }
}

mysql_close($con);
?>
<commit_msg>BUG FIX: Resources are not listed properly. Resolved: Fixed wrong use of resource id.<commit_after><?php 
$con = mysql_connect("localhost", "ngembryo", "ngembryo");
if (!$con) {
    die('Could not connect: '.mysql_error());
}

mysql_select_db("ngembryo", $con);

$table = "2DmarkerResource";
if ($_GET[type] == "2dregion") {
    $table = "2DregionResource";
} else {
    if ($_GET[type] == "3dmarker") {
        $table = "3DmarkerResource";
    }
}

$result = mysql_query("SELECT * FROM $table WHERE aid=$_GET[id]");

if ($_GET[format] == "json") {
    echo '[';
    if ($resource = mysql_fetch_array($result)) {
        $rid = $resource['rid'];
        $temp = mysql_query("SELECT * FROM resource WHERE id=$rid");
        $detail = mysql_fetch_array($temp);
        echo '{ id: '.$detail['id'].', title: "'.$detail['title'].'", summary: "'.$detail['abstract'].'", url: "'.$detail['url'].'"}';
    }
    while ($resource = mysql_fetch_array($result)) {
        $rid = $resource['rid'];
        $temp = mysql_query("SELECT * FROM resource WHERE id=$rid");
        $detail = mysql_fetch_array($temp);
        echo ', { id: '.$detail['id'].', title: "'.$detail['title'].'", summary: "'.$detail['abstract'].'", url: "'.$detail['url'].'"}';
    }
    echo ']';
} else {
    if ($_GET[format] == "csv") {
    	print('id,'.'title,'.'abstract,'.'url'."\n");
        while ($resource = mysql_fetch_array($result)) {
            $rid = $resource['rid'];
            $temp = mysql_query("SELECT * FROM resource WHERE id=$rid");
            $detail = mysql_fetch_array($temp);
            print($detail['id'].',"'.$detail['title'].'","'.$detail['abstract'].'","'.$detail['url'].'"'."\n");
        }    	
    } else {
        echo '<resourcelist>';
        while ($resource = mysql_fetch_array($result)) {
            $rid = $resource['rid'];
            $temp = mysql_query("SELECT * FROM resource WHERE id=$rid");
            $detail = mysql_fetch_array($temp);
            echo '<resource><id>'.$detail['id'].'</id><title>'.$detail['title'].'</title><abstract>'.$detail['abstract'].'</abstract><url>'.$detail['url'].'</url></resource>';
        }
        echo '</resourcelist>';
    }
}

mysql_close($con);
?>

{'fraction_non_alphanumeric': 0.2422846614463381, 'fraction_numerical': 0.0023030861354214646, 'mean_word_length': 3.1599616858237547, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '7100372', 'n_tokens_mistral': 1391, 'n_tokens_neox': 1415, 'n_words': 259}