<commit_before><?php
if(isset($_GET['server'], $_GET["queue"])) {
	$server = $_GET["server"];
	$queue = $_GET["queue"];
} else {
	http_response_code(404);
	include('404.php');
	exit;
}
include 'header.php';
?>

<div class="container">
	<?php
	if (($queue == "ranked_solo_5x5") && ($server == "eune" || $server == "euw" || $server == "na")) {
		echo "<h1 class='text-uppercase'>$server SOLO QUEUE</h1>";
	}	elseif (($queue == "ranked_flex_sr") && ($server == "eune" || $server == "euw" || $server == "na")) {
		echo "<h1 class='text-uppercase'>$server FLEX QUEUE</h1>";
	}	elseif (($queue == "ranked_flex_tt") && ($server == "eune" || $server == "euw" || $server == "na")) {
		echo "<h1 class='text-uppercase'>$server TWISTED TREELINE</h1>";
	}	else {
		echo "<h1 class='text-center'>Fyrirgefðu, við styðjum ekki þennan server eða þetta queue.<br><small>Vinsamlegast veldu aðra síðu fyrir ofan.</small></h1>";
		include 'footer.php';
		exit;
	}
	?>
	<table class="leagues table table-bordered table-striped table-hover">
		<thead>
			<tr>
				<th>Rank</th>
				<th>Summoner</th>
				<th>Tier</th>
				<th>LP</th>
				<th>Wins</th>
				<th>Losses</th>
				<th>Win %</th>
				<th>Most Played Champions</th>
			</tr>
			<?php $sth = $pdo->prepare("SELECT leagues.playerOrTeamId, leagues.playerOrTeamName, leagues.tier, leagues.division, leagues.leaguePoints, leagues.wins, leagues.losses,
				champions.id, champions.championName1, champions.championName2, champions.championName3, ROUND(100 * leagues.wins / (leagues.wins + leagues.losses)) as 'winPercentage'
				FROM {$server}_{$queue} leagues INNER JOIN {$server}_most_played_champions champions ON leagues.playerOrTeamId = champions.id
				order by case
				when leagues.tier = 'CHALLENGER' then 1
				when leagues.tier = 'MASTER' then 2
				when leagues.tier = 'DIAMOND' then 3
				when leagues.tier = 'PLATINUM' then 4
				when leagues.tier = 'GOLD' then 5
				when leagues.tier = 'SILVER' then 6
				when leagues.tier = 'BRONZE' then 7
				End,
				leagues.tier ASC, leagues.division ASC, leagues.leaguePoints DESC");
				$sth->execute(); ?>
			</thead><commit_msg>Make leagues.php support the dynamic includes of index.php, and fix some bad coding.<commit_after><div class="container">

	<?php
	$server = $_GET['server'];
	$queue = $_GET["queue"];

	if (!empty($server) && (!empty($queue)) && ($server == "eune") || ($server == "euw") || ($server == "na")) {

		if ($queue == "ranked_solo_5x5") {
			$ranked_queue = "Solo Queue";
		}
		elseif ($queue == "ranked_flex_sr") {
			$ranked_queue = "Flex Queue";
		}
		elseif ($queue == "ranked_flex_tt") {
			$ranked_queue = "Twisted Treeline";
		}
		else {
			include '404.php';
		}

		echo "<h1 class='text-uppercase'>$server $ranked_queue</h1>";

	}
	else {
		include('404.php');
	}
	?>

	<table class="leagues table table-bordered table-striped table-hover">
		<thead>
			<tr>
				<th>Rank</th>
				<th>Summoner</th>
				<th>Tier</th>
				<th>LP</th>
				<th>Wins</th>
				<th>Losses</th>
				<th>Win %</th>
				<th>Most Played Champions</th>
			</tr>
			<?php $sth = $pdo->prepare("SELECT leagues.playerOrTeamId, leagues.playerOrTeamName, leagues.tier, leagues.division, leagues.leaguePoints, leagues.wins, leagues.losses,
				champions.id, champions.championName1, champions.championName2, champions.championName3, ROUND(100 * leagues.wins / (leagues.wins + leagues.losses)) as 'winPercentage'
				FROM {$server}_{$queue} leagues INNER JOIN {$server}_most_played_champions champions ON leagues.playerOrTeamId = champions.id
				order by case
				when leagues.tier = 'CHALLENGER' then 1
				when leagues.tier = 'MASTER' then 2
				when leagues.tier = 'DIAMOND' then 3
				when leagues.tier = 'PLATINUM' then 4
				when leagues.tier = 'GOLD' then 5
				when leagues.tier = 'SILVER' then 6
				when leagues.tier = 'BRONZE' then 7
				End
				leagues.tier ASC, leagues.division ASC, leagues.leaguePoints DESC");
				$sth->execute(); ?>
			</thead>
{'fraction_non_alphanumeric': 0.17650037984299824, 'fraction_numerical': 0.01316789060521651, 'mean_word_length': 3.9936788874841973, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 69, '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': '1323603', 'n_tokens_mistral': 1720, 'n_tokens_neox': 1442, 'n_words': 326}