Fix paths when hosted in subdirectory

I ran into problems with the paths in URLs generated by some parts of graylog2's web interface when hosting it in a subdirectory (e.g. https:example.com/graylog2/ instead of https://graylog2.example.com/). Below are all the changes I've found so far that are needed to correct the paths. Please let me know if these look good, or if you prefer I fix the paths in some other way.