Code Duplication    Length = 5-5 lines in 5 locations

Sources/Stats.php 5 locations

@@ 229-233 (lines=5) @@
226
	}
227
	$smcFunc['db_free_result']($members_result);
228
229
	foreach ($context['stats_blocks']['posters'] as $i => $poster)
230
	{
231
		$context['stats_blocks']['posters'][$i]['percent'] = round(($poster['num'] * 100) / $max_num_posts);
232
		$context['stats_blocks']['posters'][$i]['num'] = comma_format($context['stats_blocks']['posters'][$i]['num']);
233
	}
234
235
	// Board top 10.
236
	$boards_result = $smcFunc['db_query']('', '
@@ 266-270 (lines=5) @@
263
	}
264
	$smcFunc['db_free_result']($boards_result);
265
266
	foreach ($context['stats_blocks']['boards'] as $i => $board)
267
	{
268
		$context['stats_blocks']['boards'][$i]['percent'] = round(($board['num'] * 100) / $max_num_posts);
269
		$context['stats_blocks']['boards'][$i]['num'] = comma_format($context['stats_blocks']['boards'][$i]['num']);
270
	}
271
272
	// Are you on a larger forum?  If so, let's try to limit the number of topics we search through.
273
	if ($modSettings['totalMessages'] > 100000)
@@ 338-342 (lines=5) @@
335
	}
336
	$smcFunc['db_free_result']($topic_reply_result);
337
338
	foreach ($context['stats_blocks']['topics_replies'] as $i => $topic)
339
	{
340
		$context['stats_blocks']['topics_replies'][$i]['percent'] = round(($topic['num'] * 100) / $max_num_replies);
341
		$context['stats_blocks']['topics_replies'][$i]['num'] = comma_format($context['stats_blocks']['topics_replies'][$i]['num']);
342
	}
343
344
	// Large forums may need a bit more prodding...
345
	if ($modSettings['totalMessages'] > 100000)
@@ 408-412 (lines=5) @@
405
	}
406
	$smcFunc['db_free_result']($topic_view_result);
407
408
	foreach ($context['stats_blocks']['topics_views'] as $i => $topic)
409
	{
410
		$context['stats_blocks']['topics_views'][$i]['percent'] = round(($topic['num'] * 100) / $max_num);
411
		$context['stats_blocks']['topics_views'][$i]['num'] = comma_format($context['stats_blocks']['topics_views'][$i]['num']);
412
	}
413
414
	// Try to cache this when possible, because it's a little unavoidably slow.
415
	if (($members = cache_get_data('stats_top_starters', 360)) == null)
@@ 468-472 (lines=5) @@
465
	ksort($context['stats_blocks']['starters']);
466
	$smcFunc['db_free_result']($members_result);
467
468
	foreach ($context['stats_blocks']['starters'] as $i => $topic)
469
	{
470
		$context['stats_blocks']['starters'][$i]['percent'] = round(($topic['num'] * 100) / $max_num);
471
		$context['stats_blocks']['starters'][$i]['num'] = comma_format($context['stats_blocks']['starters'][$i]['num']);
472
	}
473
474
	// Time online top 10.
475
	$temp = cache_get_data('stats_total_time_members', 600);