Fix PHP warning "Undefined index: extension" when attempting to get URL of a directory