code: function build(scope, attrs) {
  
                  // Block divide by 0 and empty page size
                  if (!scope.pageSize || scope.pageSize < 0)
                  {
                      return;
                  }
  
                  // Assign scope values
                  setScopeValues(scope, attrs);
  
                  // local variables
                  var start,
                      size = scope.adjacent * 2,
                      pageCount = Math.ceil(scope.total / scope.pageSize);
  
                  // Validation Scope
                  validateScopeValues(scope, pageCount);
  
                  // Add the Next and Previous buttons to our list
                  addPrevNext(scope, pageCount, 'prev');
  
                  if (pageCount < (5 + size)) {
  
                      start = 1;
                      addRange(start, pageCount, scope);
  
                  } else {
  
                      var finish;
  
                      if (scope.page <= (1 + size)) {
  
                          start = 1;
                          finish = 2 + size + (scope.adjacent - 1);
  
                          addRange(start, finish, scope);
                          addLast(pageCount, scope, finish);
  
                      } else if (pageCount - size > scope.page && scope.page > size) {
  
                          start = scope.page - scope.adjacent;
                          finish = scope.page + scope.adjacent;
  
                          addFirst(scope, start);
                          addRange(start, finish, scope);
                          addLast(pageCount, scope, finish);
  
                      } else {
  
                          start = pageCount - (1 + size + (scope.adjacent - 1));
                          finish = pageCount;
  
                          addFirst(scope, start);
                          addRange(start, finish, scope);
  
                      }
                  }
                  addPrevNext(scope, pageCount, 'next');
              }
docs: Main build function