In C you can get the "/" as a result from basename. Maybe that should be handled here as well, such as
```
if ($parent ==='.' || $parent ==='/') {
   $parent = '';
}