<commit_before><?php
require '../assets/includes/connect.php';
require '../assets/includes/database.php';
header("Content-Type: application/json");

$response = array();
$max = 10;
$type = "all";
$sort = "popularity";

$types = ["all", "images", "scripts", "sounds"];
$sorts = ["popularity", "alphabetical", "newest", "oldest"];

if(isset($_GET['max'])){
	$max = intval($_GET['max']);
}

if(isset($_GET['type'])){
	$type = $_GET['type'];
}

if(isset($_GET['sort'])){
	$sort = $_GET['sort'];
}

if(!in_array($type, $types)){
	$type = "all";
}

if(!in_array($sort, $sorts)){
	$sort = "popularity";
}

connectDatabase();
$query = "SELECT * FROM `" . getAssetsTableName() . "`";
$params = array();
if($type != "all"){
	$query .= "WHERE `asset_type`=?";
	array_push($params, $type);
}

if($sort == "popularity"){
	// implement
} else if($sort == "popularity"){
	$query .= "ORDER BY `customName`";
} else if($sort == "alphabetical"){
	$query .= "ORDER BY `customName`";
} else if($sort == "newest"){
	$query .= "ORDER BY `date` DESC";
} else if($sort == "oldest"){
	$query .= "ORDER BY `date`";
}

$query .= " LIMIT ?";<commit_msg>Fix bug in list.php<commit_after><?php
require '../assets/includes/connect.php';
require '../assets/includes/database.php';
header("Content-Type: application/json");

$response = array();
$max = 10;
$type = "all";
$sort = "popularity";

$types = ["all", "images", "scripts", "sounds"];
$sorts = ["popularity", "alphabetical", "newest", "oldest"];

if(isset($_GET['max'])){
	$max = intval($_GET['max']);
}

if(isset($_GET['type'])){
	$type = $_GET['type'];
}

if(isset($_GET['sort'])){
	$sort = $_GET['sort'];
}

if(!in_array($type, $types)){
	$type = "all";
}

if(!in_array($sort, $sorts)){
	$sort = "popularity";
}

connectDatabase();
$query = "SELECT * FROM `" . getAssetsTableName() . "`";
$params = array();
if($type != "all"){
	$query .= "WHERE `assetType`=?";
	array_push($params, $type);
}

if($sort == "popularity"){
	// implement
} else if($sort == "popularity"){
	$query .= "ORDER BY `customName`";
} else if($sort == "alphabetical"){
	$query .= "ORDER BY `customName`";
} else if($sort == "newest"){
	$query .= "ORDER BY `date` DESC";
} else if($sort == "oldest"){
	$query .= "ORDER BY `date`";
}

$query .= " LIMIT ?";
{'fraction_non_alphanumeric': 0.26917960088691795, 'fraction_numerical': 0.0017738359201773836, 'mean_word_length': 5.214876033057851, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '198667', 'n_tokens_mistral': 873, 'n_tokens_neox': 843, 'n_words': 183}