<?php

	// Included files
	require_once __DIR__ . "/../backend/common.php";
	require_once __DIR__ . "/../backend/language.php";
	
	
	// Main function
	
	// Get path
	$path = $_SERVER["REQUEST_URI"];
	
	// Check if accessing 502 error page directly
	if($path === "/errors/502.html" || startsWith($path, "/errors/502.html?") === TRUE) {
	
		// Require 404 error page
		require __DIR__ . "/404.html";
		
		// Exit
		exit();
	}
	
	// Set error header
	header($_SERVER["SERVER_PROTOCOL"] . " 502 Bad Gateway");
	header("Status: 502 Bad Gateway");

	// Set title, title argument, error, error argument, and message
	$title = getDefaultTranslation('MWC Wallet — Error %1$s');
	$titleArgument = 502;
	$error = getDefaultTranslation('Error %1$s');
	$errorArgument = 502;
	$message = getDefaultTranslation('Bad Gateway');
	
	// Require template
	require __DIR__ . "/template.php";
?>
