<?php
require_once __DIR__.'/../../_bootstrap.php';
require_once ROOT_PATH.'/includes/match_functions.php';
$u=afApiOuSessaoUsuario($pdo);
$periodo=afPeriodoValido((string)($_GET['periodo']??'global'));
$escopo=afEscopoValido((string)($_GET['escopo']??'global'));
$limite=max(1,min(100,(int)($_GET['limite']??50)));
$offset=max(0,(int)($_GET['offset']??0));
jsonResponse(['ok'=>true,'ranking'=>afRanking($pdo,$periodo,$escopo,$u,$limite,$offset)]);
