CCBC-268 Check bounds when calculating replica node index

Change-Id: Ied314cb9d467778e1a23aea402511901cdbe14d6
Reviewed-on: http://review.couchbase.org/28895
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>