Fix installation problem due to import in __init__.py

Since setup.py is importing __init__ for version, this cause the
dependency to not be installable since __init__ requires unexisted
module before it's actually installed.
Calculate total post count from post number instead of actual count.

If non-latest posts are deleted, post count and post number won't be in
sync if we use actual count. This cause post number to exceed number of
max posts before the thread is locked (since count is smaller than post
number).

This commit also fixes a problem where format_markdown can't accept
None and cause the app to fails.
Make recent_posts query no longer depends on post_count.

When post_count is not in sync with actual post number, it will cause
recent_posts to misbehaves by displaying more posts than intended (when
post number is > post count) or fewer posts than intended (when deleted
post is still within the display range).