Nice fix but I think I have just created one which works better performance wise because it only gets the desired number of articles from the database. The posted fix seems to get a query with 100 records and only limiting the number processed. It's also less to change ;-)
The fix I just created is also configurable from the administrator.
Backup \modules\mod_related_items.php and \modules\mod_related_items.xml
1. Open \modules\mod_related_items.php
2. Look for (line 17)
global $mosConfig_offset, $option, $task;
3. Below add
$count = intval( $params->get( 'count', 10 ) );
4. Find (line 59)
$database->setQuery( $query );
5. Replace with
$database->setQuery( $query, 0, $count );
6. Open \modules\mod_related_items.xml
7. Look for (line 21)
8. Above add
<param name="count" type="text" default="10" label="Count" description="The number of items to display (default 10)" />
Save and upload and configure from the modules administrator.
The way I came up with this fix is by looking how the latest items module was limited and applied the same to the related items module.
You can see this in action on http://www.sportfotografie.us
in any content item (lees meer). It's the top module on the right called 'Gerelateerde items'.