- Added count_dir_elements() function.
- Changed the args for sanitize_path() so that the caller can request
the value for the rootdir and so that the caller tells us the current
subdir depth instead of sending us a string that we have to figure it
out from.
- Make sure that sanitize_path() doesn't mis-parse multiple adjacent
slashes.