HG-366, HG-417, HG-418 Various fixes for linked images in Mercury

There were some smaller and bigger defects in linked images implementation:
* "View more" link was displayed even if there were <=4 images,
* the chevron for linked images was displayed even for images which weren't linked to anything,
* the images weren't sorted correctly,
* three images out of 4 were rendered after opening a page.

Changes in this pull request fix the defects.