Prefer descriptive names over temp-var naming; makes it hard to follow at a glance.

This is taking the basename of the URL, extracting its .ext and prefix, then joining them back together into a filename.

When will the pref.ext construction differ from just using the basename directly? Why is it needed?