From b82f4e53565b0ceb0ba8930cbbc1555f1093f4d5 Mon Sep 17 00:00:00 2001
From: Eric Lippmann <eric.lippmann@netways.de>
Date: Tue, 30 Dec 2014 10:33:32 +0100
Subject: [PATCH] monitoring: Count hosts in downtime once in hosts/show.phtml

---
 .../application/views/scripts/hosts/show.phtml         | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/modules/monitoring/application/views/scripts/hosts/show.phtml b/modules/monitoring/application/views/scripts/hosts/show.phtml
index e6fc7f8be..dc0165497 100644
--- a/modules/monitoring/application/views/scripts/hosts/show.phtml
+++ b/modules/monitoring/application/views/scripts/hosts/show.phtml
@@ -107,10 +107,18 @@
 
         <?php if (! empty($objectsInDowntime)): ?>
             <h2>
+                <?php $inDowntimeCount = count($objectsInDowntime) ?>
                 <a href="<?= $inDowntimeLink ?>"
                    title="<?= $this->translate('Hosts in downtime') ?>">
                     <?= $this->icon('plug') ?>
-                    <?= sprintf($this->translatePlural('%u host is in downtime', '%u hosts are in downtime', count($objectsInDowntime)),count($objectsInDowntime)) ?>
+                    <?= sprintf(
+                        $this->translatePlural(
+                            '%u host is in downtime',
+                            '%u hosts are in downtime',
+                            $inDowntimeCount
+                        ),
+                        $inDowntimeCount
+                    ) ?>
                 </a>
             </h2>
         <?php endif ?>