Refactor TagController#index.

Also fixes moebooru/moebooru#37 (github).