Conditional check on get_index_name

Only return an index name if passed a valid blog_id. Added relevant tests.

@tlovett1 #reviewmerge