foreach($pages as $name=>$page)
{
$class = "class=\"nav-item\"";
if (str_ends_with($_SERVER['SCRIPT_FILENAME'], $page))
$class = str_replace("\"nav-item\"", "\"nav-item active\"", $class);
foreach($pages as $name=>$page)
{
$class = "class=\"nav-item\"";
if (str_ends_with($_SERVER['SCRIPT_FILENAME'], $page))
$class = str_replace("\"nav-item\"", "\"nav-item active\"", $class);