diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php
index 6a602b7de8..c9c8cc3b85 100644
--- a/phpBB/includes/functions_acp.php
+++ b/phpBB/includes/functions_acp.php
@@ -290,27 +290,17 @@ function build_cfg_template($tpl_type, $key, &$new_ary, $config_key, $vars)
case 'time':
case 'number':
case 'range':
- $max = '';
- $min = ( isset($tpl_type[1]) ) ? (int) $tpl_type[1] : false;
- if ( isset($tpl_type[2]) )
- {
- $max = (int) $tpl_type[2];
- }
+ $min = isset($tpl_type[1]) ? (int) $tpl_type[1] : false;
+ $max = isset($tpl_type[2]) ? (int) $tpl_type[2] : false;
- $tpl = '';
+ $tpl = '';
break;
case 'dimension':
- $max = '';
+ $min = isset($tpl_type[1]) ? (int) $tpl_type[1] : false;
+ $max = isset($tpl_type[2]) ? (int) $tpl_type[2] : false;
- $min = (int) $tpl_type[1];
-
- if ( isset($tpl_type[2]) )
- {
- $max = (int) $tpl_type[2];
- }
-
- $tpl = ' x ';
+ $tpl = ' x ';
break;
case 'textarea':
diff --git a/tests/functions_acp/build_cfg_template_test.php b/tests/functions_acp/build_cfg_template_test.php
index 2e3a8adac7..a3e722c61c 100644
--- a/tests/functions_acp/build_cfg_template_test.php
+++ b/tests/functions_acp/build_cfg_template_test.php
@@ -114,6 +114,14 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case
array(),
'',
),
+ array(
+ array('number', 0, 9999),
+ 'number_key_name',
+ array('config_key_name' => 10),
+ 'config_key_name',
+ array(),
+ '',
+ ),
);
}