                 if rest is 0
                     last -= 1
                 
-                linkdepth = @data.linkdepth || 1
-                href = location.pathname.split('/')
-                href[linkdepth + 1] = ''
+                @__root.append @_createLink 0, 'first', @data.text.first, 'first', @data.imageLinks
                 
-                href[linkdepth] = 0
-                @__root.append @_createLink href.join('/'), 'first', @data.text.first, 'first', @data.imageLinks
-                
-                href[linkdepth] = if curr > 0 then curr - 1 else last 
-                @__root.append @_createLink href.join('/'), 'left', @data.text.left, 'prev', @data.imageLinks
+                offset = if curr > 0 then curr - 1 else last 
+                @__root.append @_createLink offset, 'left', @data.text.left, 'prev', @data.imageLinks
                 
                 @_process [0..last],
     
                     each: (i, next)=>
-                        href[linkdepth] = i
-                        
-                        link = @_createLink href.join('/'), 'page', ''+(i + 1), 'page'
+                    
+                        link = @_createLink i, 'page', ''+(i + 1), 'page'
                     
                         if i is curr
                             link.addClass 'actual'


module.exports =
    

        ##
        ##
        ##
        _createLink: (offset, type, text, _class, img)->
            
            if search = @data.search
                href = location.pathname
                @__query ?= if location.search then qs.parse location.search.substr 1 else {}
                
                @__query[search] = ''+offset
                href = href+'?'+qs.stringify @__query
                
            else
                linkdepth = @data.linkdepth || 1
                @__href ?= location.pathname.split('/')
                @__href[linkdepth] = offset
                @__href[linkdepth + 1] = ''
                
                href = @__href.join '/'
                

            link = $('<a>').attr('href', href).attr 'class', 'link '+_class
            
            if !img
