Cast wp_count_attachments() before iterating it to avoid a notice when items exist without a mime type.

props bobbingwide.
fixes #27802.


git-svn-id: https://develop.svn.wordpress.org/trunk@28139 602fd350-edb4-49c9-b593-d223f7449a82