Just dirname() instead of pathinfo?