Looks fine to me! I rewrote it from scratch, just for fun but the code is about the same length and the approach looks the same:
$path = $_SERVER["PHP_SELF"];
$parts = explode('/',$path);
if (count($parts) < 2)
{
echo("home");
}
else
{
echo ("<a href=\\"/index.php\\">home</a> -> ");
for ($i = 1; $i < count($parts); $i++)
{
if (!strstr($parts[$i],"."))
{
echo("<a href=\\"");
for ($j = 0; $j <= $i; $j++) {echo $parts[$j]."/";};
echo("\\">".$parts[$i]."</a> ->");
}
else
{
$str = $parts[$i];
$pos = strrpos($str,".");
$parts[$i] = substr($str, 0, $pos);
echo $parts[$i];
};
};
};