#478415
foreach ($_SESSION['pg'] as $str) { echo '<a href="' . $pth . $str . '.php">' . $str . '</a><br>'; }