Here's an implementation of a path collapsing util

This includes more tests. Next step is to wire this up in an Aspen hook
to run at request time.