diff --git a/lib/redmine/wiki_formatting/macros.rb b/lib/redmine/wiki_formatting/macros.rb
index 6203fd0..da2e663 100644
--- a/lib/redmine/wiki_formatting/macros.rb
+++ b/lib/redmine/wiki_formatting/macros.rb
@@ -90,8 +90,9 @@ module Redmine
              "  !{{child_pages}} -- can be used from a wiki page only\n" +
              "  !{{child_pages(Foo)}} -- lists all children of page Foo\n" +
              "  !{{child_pages(Foo, parent=1)}} -- same as above with a link to page Foo"
+             "  !{{child_pages(Foo, parent=1, depth=3)}} -- same as above with specified nesting level (default 2)"
       macro :child_pages do |obj, args|
-        args, options = extract_macro_options(args, :parent)
+        args, options = extract_macro_options(args, :parent, :depth)
         page = nil
         if args.size > 0
           page = Wiki.find_page(args.first.to_s, :project => @project)
@@ -101,7 +102,8 @@ module Redmine
           raise 'With no argument, this macro can be called from wiki pages only.'
         end
         raise 'Page not found' if page.nil? || !User.current.allowed_to?(:view_wiki_pages, page.wiki.project)
-        pages = ([page] + page.descendants).group_by(&:parent_id)
+
+        pages = ([page] + page.descendants(options[:depth])).group_by(&:parent_id)
         render_page_hierarchy(pages, options[:parent] ? page.parent_id : page.id)
       end
 
diff --git a/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb b/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb
index 54b4373..2feaf24 100644
--- a/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb
+++ b/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb
@@ -73,8 +73,15 @@ module ActiveRecord
         # Returns list of descendants.
         #
         #   root.descendants # => [child1, subchild1, subchild2]
-        def descendants
-          children + children.collect(&:children).flatten
+        #   root.descendants(1) # => [child1]
+        #
+        #   Defaults: depth = 2 (old behavior)
+        def descendants(depth=2)
+          depth = 2 if depth.nil?
+          depth = depth.to_i
+          result = children.dup
+          result += children.collect { |item| item.descendants_deep(depth-1) }.flatten if depth > 1
+          result
         end
 
         # Returns list of descendants and a reference to the current node.
