Index: src/webapp/webservice/index.php
===================================================================
--- src/webapp/webservice/index.php	(revision 95db5cc2d4baef8f2cc716aae6a44ec0e17c42d3)
+++ src/webapp/webservice/index.php	(revision acea570b0635ec73a8720aa1400f7f987aa2b2ff)
@@ -16,4 +16,6 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+xdebug_start_trace();
 
 require_once(__DIR__ ."/inc/Config.php");
@@ -63,14 +65,18 @@
 	$lastTime = -1;
 	$keys = array_keys($data);
-	if(count($keys) < 0 ){
+	$keyTimeframes = $keys[0];
+	$itemCount = count($keys);
+	if($itemCount < 0 ){
 		error_log("No keys in fetched rrd data from ". $dbFile);
 		echo json_encode("");
 		exit;
 	}
+	$timeframesCount = count($data[$keyTimeframes]);
 	if($debug > 0){
-		echo "<p>Variables: ". count($keys) ."; Timeframes: ". count($data[$keys[0]]) ."</p>\n";
+		echo "<p>Variables: ". $itemCount ."; Timeframes: ". $timeframesCount ."</p>\n";
 	}
-	for($i = 0; $i < count($data[$keys[0]]); $i++){
-		$time = array_keys($data[$keys[0]])[$i];
+	$keysTimeframes = array_keys($data[$keyTimeframes]);
+	for($i = 0; $i < $timeframesCount; $i++){
+		$time = $keysTimeframes[$i];
 		$allValid = true;
 		$tmp = array();
@@ -175,3 +181,5 @@
 }
 
+xdebug_stop_trace();
+
 ?>
