Yii2:如何使用UrlManager的分页构建正确的模式?

I have following conditions:

1) expected request is /a1,a2,aN[/.../n1,n2,nN][?range=xxx-yyyy[&search=string]] (square brackets contain optional parts)

2) action method signature is public function actionIndex(string $alias = '', string $range = '', string $search = ''): string

3) so I used a rule for this:

[
    'pattern'      => '<alias:[\\w-,\\/]+>',
    'route'        => 'shop/products/index',
    'encodeParams' => false,
],

It works properly until I try to add pagination, LinkPager ignores a rule I wrote:

[
    'pattern'      => '<alias:[\\w-,\\/]+>/<page:\d+>',
    'route'        => 'shop/products/index',
    'encodeParams' => false,
],

and displays the alias and page params as GET variables.

What is a right rule adding the page number in the end of request URI like /a1,a2,aN/n1,n2,nN/2 and ignoring if the number is 1?

UPD: I found a reason, this is a rule I defined before:

'/shop' => 'shop/products/index', //it breaks following rules
[
    'pattern'      => '<alias:[\\w-,\\/]+>/<page:\d+>',
    'route'        => 'shop/products/index',
    'encodeParams' => false,
],
[
    'pattern'      => '<alias:[\\w-,\\/]+>',
    'route'        => 'shop/products/index',
    'encodeParams' => false,
],

So, how I to make all these rules work together?

Solution 1: To make another action method which works without alias argument and calls actionIndex with empty one.

Solution 2: To make same rules with different mode in special order:

[
    'name'         => 'This rule is first when we create a link',
    'pattern'      => '<alias:[\\w-,\\/]+>/<page:\d+>',
    'route'        => 'shop/products/index',
    'encodeParams' => false,
    'mode'         => \yii\web\UrlRule::CREATION_ONLY,
],
[
    'name'         => 'This rule is first when we parse a request',
    //
    'pattern'      => 'shop/<page:\d+>',
    'route'        => 'shop/products/index',
],
[
    'name'         => 'Used for parsing when previous rule does not match',
    'pattern'      => '<alias:[\\w-,\\/]+>/<page:\d+>',
    'route'        => 'shop/products/index',
    'encodeParams' => false,
    'mode'         => \yii\web\UrlRule::PARSING_ONLY,
],

[
    'name'         => 'Same as first but when link has no page number',
    'pattern'      => '<alias:[\\w-,\\/]+>',
    'route'        => 'shop/products/index',
    'encodeParams' => false,
    'mode'         => \yii\web\UrlRule::CREATION_ONLY,
],
[
    'name'         => 'First when parsing request with no page number',
    'pattern'      => 'shop',
    'route'        => 'shop/products/index',
],
[
    'name'         => 'Used for parsing when previous rule does not match',
    'pattern'      => '<alias:[\\w-,\\/]+>',
    'route'        => 'shop/products/index',
    'encodeParams' => false,
    'mode'         => \yii\web\UrlRule::PARSING_ONLY,
],

If you know a better solution with one action I'll be glad to see it.